import { FlightFormSchema } from "@/util/types"; import { FileInput, FileInputProps, Pill } from "@mantine/core"; import { UseFormReturnType } from "@mantine/form"; import { randomId } from "@mantine/hooks"; import { IconPhoto } from "@tabler/icons-react"; export default function ImageUpload({ form, field, label = "", placeholder = "", }: { form: UseFormReturnType< FlightFormSchema, (values: FlightFormSchema) => FlightFormSchema >; field: string; label?: string; placeholder?: string; }) { const ValueComponent: FileInputProps["valueComponent"] = ({ value }) => { if (value === null) { return null; } if (Array.isArray(value)) { return ( {value.map((file) => ( {file.name} ))} ); } return {value.name}; }; return ( } {...form.getInputProps(field)} /> ); }