refactor: add File in FormElements
This commit is contained in:
1 parent
a3cb0616c1
commit
41bea34b2f
2 files changed
+11
-3
No files matched your search
+1
-3
@@ -207,12 +207,10 @@ export default function AdminPage() {
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-neutral-400 uppercase tracking-wider mb-1.5">Datei auswählen (.csv)</label>
|
||||
<input
|
||||
type="file"
|
||||
<Input.File
|
||||
name="csvFile"
|
||||
accept=".csv"
|
||||
required
|
||||
className="w-full text-sm text-neutral-400 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-xs file:font-semibold file:bg-neutral-800 file:text-neutral-200 hover:file:bg-neutral-700 file:transition cursor-pointer"
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-6 space-y-3">
|
||||
|
||||
@@ -25,7 +25,17 @@ function Dropdown({ children, ...props }: ComponentPropsWithoutRef<"select">) {
|
||||
);
|
||||
}
|
||||
|
||||
export function File({ ...props }: ComponentPropsWithoutRef<"input">) {
|
||||
return (
|
||||
<input
|
||||
type="file"
|
||||
className="p-1 text-sm w-full rounded-lg border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-black text-black dark:text-white cursor-pointer file:mr-4 file:py-2 file:px-4 file:rounded-sm file:border-0 file:font-semibold file:transition file:bg-neutral-100 file:text-neutral-900 dark:file:bg-neutral-800 dark:file:text-white hover:file:bg-neutral-900 hover:file:text-white dark:hover:file:bg-white dark:hover:file:text-black"
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
export const Input = {
|
||||
Text: Textfield,
|
||||
Select: Dropdown,
|
||||
File: File,
|
||||
};
|
||||
Reference in new issue
Block a user