1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 15:14:23 +00:00
festa/components/editable/EditableFilePicker.tsx

19 lines
590 B
TypeScript
Raw Normal View History

2022-06-08 17:14:00 +00:00
import { HTMLProps } from "react";
import { Editable } from "./Editable";
/**
* Controlled input component which displays an `input[type="file"]` in editing mode, and is invisible in preview mode.
*
* Value is the file's [fakepath](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#value), as a string.
*/
2022-06-09 03:05:08 +00:00
export function EditableFilePicker(props: HTMLProps<HTMLInputElement> & { value: File | "" }) {
2022-06-08 17:14:00 +00:00
return (
<Editable
editing={
<input type="file" {...props} />
}
preview={<></>}
/>
)
}