From 5f7cf1f49fc91e413e184a6d210833dc7a6976a3 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Tue, 30 Sep 2025 08:54:13 +0800 Subject: [PATCH] Made file upload a separate component --- src/components/File/File.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/File/File.tsx b/src/components/File/File.tsx index 5335f98..6e21c3c 100644 --- a/src/components/File/File.tsx +++ b/src/components/File/File.tsx @@ -1,11 +1,20 @@ import './File.sass' import { FileField } from '@kobalte/core/file-field' -export default () => { +interface Props { + maxFiles: number + accept: string + onFileAccept?: (files: File[]) => void + label: string + buttonText: string + onClick: () => void +} + +export default (props: Props) => { return ( <> - console.log('data', data)} onFileReject={(data) => console.log('data', data)} onFileChange={(data) => console.log('data', data)}> - Drag and drop or click to upload file + + {props.label} {() => ( @@ -13,7 +22,9 @@ export default () => { - Delete + + {props.buttonText} + )}