import { VNode, h } from "preact"; import { InputLine, LabelWithTooltipMaybeRequired, UIFormProps, } from "./InputLine.js"; import { useField } from "./useField.js"; export function InputFile( props: { maxBites: number; accept?: string } & UIFormProps, ): VNode { const { name, label, placeholder, tooltip, required, help, maxBites, accept, } = props; const { value, onChange } = useField<{ [s: string]: string }>(name); return (
{!value || !value.startsWith("data:image/") ? (
{/*

or drag and drop

*/}
) : (
{ onChange(undefined!); }} > Clear
)} {help &&

{help}

}
); }