Skip to content

Commit

Permalink
feat: show currently selected file in the plugin UploadField (#20827)
Browse files Browse the repository at this point in the history
show currently selected file in the plugin UploadField
  • Loading branch information
MarconLP authored Mar 12, 2024
1 parent b5e19b6 commit 941d64e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions frontend/src/scenes/plugins/edit/UploadField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import { LemonFileInput } from '@posthog/lemon-ui'

export function UploadField({ value, onChange }: { value?: File; onChange?: (file: File) => void }): JSX.Element {
return (
<LemonFileInput
accept="*"
multiple={false}
onChange={(files) => onChange?.(files[0])}
value={value?.size ? [value] : []}
showUploadedFiles={false}
/>
<>
{value?.name ? <span>Selected file: {value.name}</span> : null}
<LemonFileInput
accept="*"
multiple={false}
onChange={(files) => onChange?.(files[0])}
value={value?.size ? [value] : []}
showUploadedFiles={false}
/>
</>
)
}

0 comments on commit 941d64e

Please sign in to comment.