diff --git a/src/pages/_page.jsx b/src/pages/_page.jsx index e104a32..06dbbe0 100644 --- a/src/pages/_page.jsx +++ b/src/pages/_page.jsx @@ -1,9 +1,26 @@ import { useState, useEffect, useRef } from 'react'; import { motion } from 'framer-motion'; import QRcode from 'qrcode'; + +const Button = ({ children, onClick, isActive }) => { + return ( + + ); +}; + export default function Page() { const ref = useRef(); const [data, setData] = useState(''); + const [errorCorrectionLevel, setErrorCorrectionLevel] = useState('L'); + const [maskPattern, setMaskPattern] = useState(undefined); + const [version, setVersion] = useState(undefined); useEffect(() => { QRcode.toString( data, @@ -11,9 +28,12 @@ export default function Page() { type: 'svg', margin: 0, color: { dark: '000000FF', light: '00000000' }, + errorCorrectionLevel, + maskPattern, + version, }, (err, qrc) => { - err ? err : (ref.current.innerHTML = qrc); + err ? console.log(err) : (ref.current.innerHTML = qrc); err ? (ref.current.style.backgroundColor = 'red') : (ref.current.style.backgroundColor = 'transparent'); @@ -23,19 +43,130 @@ export default function Page() { return (
-
+ className="p-[1.5rem] grid-flow-row-dense w-full h-full" + > +
QRcode
+
+
version
+
+
+ +
+ {[ + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + '10', + '11', + '12', + '13', + '14', + '15', + '16', + '17', + '18', + '19', + '20', + '21', + '22', + '23', + '24', + '25', + '26', + '27', + '28', + '29', + '30', + '31', + '32', + '33', + '34', + '35', + '36', + '37', + '38', + '39', + '40', + ].map((v, key) => ( + + ))} +
+
+
+
mask pattern
+
+
+ +
+ {['0', '1', '2', '3', '4', '5', '6', '7'].map((mp, key) => ( + + ))} +
+
+
+
error correction level
+
+ {['L', 'M', 'Q', 'H'].map((ecl, key) => ( + + ))} +
+
+
+