diff options
author | Sebastian <sebasjm@gmail.com> | 2022-10-26 14:50:50 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-10-26 14:52:52 -0300 |
commit | b4bad2deaf93eff5858d903cd68b8fdd5a5eecd3 (patch) | |
tree | e6ead0edbd2b56cf9bcd8bc312fb07ed9280c5cc /packages/demobank-ui/src/components/FileButton.tsx | |
parent | c34e71cf3de3da90d0d1662141aa1754a42ea37a (diff) |
pretty
Diffstat (limited to 'packages/demobank-ui/src/components/FileButton.tsx')
-rw-r--r-- | packages/demobank-ui/src/components/FileButton.tsx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/packages/demobank-ui/src/components/FileButton.tsx b/packages/demobank-ui/src/components/FileButton.tsx index dba86ccbf..7fad7f03a 100644 --- a/packages/demobank-ui/src/components/FileButton.tsx +++ b/packages/demobank-ui/src/components/FileButton.tsx @@ -1,5 +1,5 @@ -import { h, VNode } from 'preact'; -import { useRef, useState } from 'preact/hooks'; +import { h, VNode } from "preact"; +import { useRef, useState } from "preact/hooks"; const MAX_IMAGE_UPLOAD_SIZE = 1024 * 1024; @@ -23,13 +23,12 @@ export function FileButton(props: Props): VNode { </button> <input ref={fileInputRef} - style={{ display: 'none' }} + style={{ display: "none" }} type="file" onChange={(e) => { const f: FileList | null = e.currentTarget.files; - if (!f || f.length != 1) - return props.onChange(undefined); - + if (!f || f.length != 1) return props.onChange(undefined); + console.log(f); if (f[0].size > MAX_IMAGE_UPLOAD_SIZE) { setSizeError(true); @@ -39,7 +38,7 @@ export function FileButton(props: Props): VNode { return f[0].arrayBuffer().then((b) => { const content = new Uint8Array(b).reduce( (data, byte) => data + String.fromCharCode(byte), - '', + "", ); return props.onChange({ content, |