From 0fb64ea0609ba0badeda91bd28084096b2a32448 Mon Sep 17 00:00:00 2001 From: CPunisher <1343316114@qq.com> Date: Fri, 1 May 2020 16:30:37 +0800 Subject: [PATCH] Basic QR Code generator --- src/components/QrItem.js | 36 ++++++++++++ src/components/QrRendererBase.js | 36 ++++++++++++ src/components/QrRendererRound.js | 36 ++++++++++++ src/components/Qrcode.js | 95 +++++++++++++++++++------------ 4 files changed, 167 insertions(+), 36 deletions(-) create mode 100644 src/components/QrItem.js create mode 100644 src/components/QrRendererBase.js create mode 100644 src/components/QrRendererRound.js diff --git a/src/components/QrItem.js b/src/components/QrItem.js new file mode 100644 index 0000000..2bcf439 --- /dev/null +++ b/src/components/QrItem.js @@ -0,0 +1,36 @@ +import React from "react"; +import './Qrcode.css' + +function calViewBox(props) { + if (!props.qrcode) return '0 0 0 0'; + + const nCount = props.qrcode.getModuleCount(); + return '0 0 ' + String(nCount) + ' ' + String(nCount); +} + +class QrItem extends React.Component { + + constructor(props) { + super(props); + this.state = { + value: props.value + } + } + + render() { + return ( +