Skip to content

Commit 87df2af

Browse files
committed
feat: from svg to img
1 parent c2cc781 commit 87df2af

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

src/Home.js

+1-14
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@ import { useJsBarcodeEan13 } from './components/Barcode'
44
import { PageContainer } from './components/PageContainer'
55
import { Input } from './components/Input'
66
import { Label } from './components/Label'
7-
import { Button } from './components/Button'
8-
9-
async function handleClick() {
10-
document.querySelector('#barcode').toBlob(function (blob) {
11-
// eslint-disable-next-line no-undef
12-
const item = new ClipboardItem({ 'image/png': blob })
13-
navigator.clipboard.write([item])
14-
})
15-
}
167

178
export function Home() {
189
const [ean13, setEan13] = useState('')
@@ -45,10 +36,6 @@ export function Home() {
4536
onChange={onInputChange}
4637
/>
4738
</Label>
48-
49-
<Button onClick={handleClick} disabled={ean13?.length !== 13 || error}>
50-
Copier le barcode
51-
</Button>
5239
</x.div>
5340

5441
<x.div textAlign="center" mt={4} h={40} p={3} w={1}>
@@ -58,7 +45,7 @@ export function Home() {
5845
<x.span color="red">code invalide</x.span>
5946
</p>
6047
) : ean13.length === 13 ? (
61-
<canvas id="barcode"></canvas>
48+
<img id="barcode" alt="generated-barcode" />
6249
) : (
6350
<p>
6451
Remplissez le champ avec 13 chiffres pour générer le code barre.

0 commit comments

Comments
 (0)