Skip to content

Commit

Permalink
Merge branch 'aidenybai:main' into weather-app
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberviking5 committed Oct 3, 2023
2 parents dcea2e5 + a334f16 commit b896989
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 13 deletions.
1 change: 1 addition & 0 deletions packages/kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.11",
"react-icons": "^4.11.0",
"react-qr-code": "^2.0.12",
"react-redux": "^8.1.3",
"react-router-dom": "^6.15.0",
"styled-components": "^6.0.7",
Expand Down
38 changes: 38 additions & 0 deletions packages/kitchen-sink/src/examples/qr-code-generator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { block } from 'million/react';
import { useState, useRef } from 'react';
import QRCode from 'react-qr-code';

const QRCodeGenerator = block(() => {
const [data, setData] = useState<string | null>(null);
const inputRef = useRef<HTMLInputElement>(null);
return (
<div>
<h1>QR Code Generator</h1>
<div>
<input
placeholder="Enter text or URL"
style={{ width: '40%' }}
ref={inputRef}
type="text"
/>
<button
style={{ marginLeft: 10 }}
onClick={() => {
if (inputRef.current) {
setData(inputRef.current.value);
}
}}
>
Generate
</button>
</div>
{data && (
<div className="qr-code-wrapper">
<QRCode value={data} />
</div>
)}
</div>
);
});

export default QRCodeGenerator;
10 changes: 9 additions & 1 deletion packages/kitchen-sink/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,12 @@ input[type="range"] {
}
}

/* */
/* */

/* QR code styles */
.qr-code-wrapper {
display: inline-flex;
background: white;
margin-top: 2rem;
padding: 1rem;
}
46 changes: 34 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b896989

Please sign in to comment.