Skip to content

Commit

Permalink
finish QR code Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
No0ne003 committed Mar 28, 2024
1 parent 59bb801 commit 2ccbef3
Showing 1 changed file with 44 additions and 4 deletions.
48 changes: 44 additions & 4 deletions src/pages/QRCodeGenerator.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,48 @@
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import QRCode from "react-qr-code";
import { useState } from "react";

const QRCodeGenerator = () => {
const [qrCode, setQrCode] = useState("");
const [input, setInput] = useState("");

function handleGenerateQrCode() {
setQrCode(input);
setInput("");
}

return (
<div>QRCodeGenerator</div>
)
}
<div
className={`container flex flex-col flex-1 items-center justify-center gap-8 my-10 w-full max-h-screen relative overflow-x-hidden`}
>
<h1>QR Code Generator</h1>
<div className="flex gap-3">
<Input
onChange={(e) => setInput(e.target.value)}
type="text"
name="qr-code"
value={input}
placeholder="Enter your value here"
/>
<Button
disabled={input && input.trim() !== "" ? false : true}
onClick={handleGenerateQrCode}
variant="secondary"
>
Generate
</Button>
</div>
<div>
<QRCode
id="qr-code-value"
value={qrCode}
size={400}
bgColor="transparent"
/>
</div>
</div>
);
};

export default QRCodeGenerator
export default QRCodeGenerator;

0 comments on commit 2ccbef3

Please sign in to comment.