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.
|
|
|
|
*
|
2022-06-09 22:01:27 +00:00
|
|
|
* Has no value due to how file inputs function in JS and React.
|
2022-06-08 17:14:00 +00:00
|
|
|
*/
|
2022-06-09 20:45:22 +00:00
|
|
|
export function EditableFilePicker(props: HTMLProps<HTMLInputElement> & { value?: undefined }) {
|
2022-06-08 17:14:00 +00:00
|
|
|
return (
|
|
|
|
<Editable
|
|
|
|
editing={
|
|
|
|
<input type="file" {...props} />
|
|
|
|
}
|
|
|
|
preview={<></>}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|