2022-06-05 21:03:48 +00:00
|
|
|
import { HTMLProps } from "react";
|
2022-06-08 15:38:30 +00:00
|
|
|
import { EditingContext } from "../contexts/editing";
|
2022-06-05 21:03:48 +00:00
|
|
|
import { useDefinedContext } from "../../utils/definedContext";
|
|
|
|
import { Postcard } from "../postcard/Postcard";
|
|
|
|
|
|
|
|
|
2022-06-08 00:40:14 +00:00
|
|
|
export function EditablePostcard({value, ...props}: HTMLProps<HTMLInputElement> & {value: string | undefined}) {
|
2022-06-05 21:03:48 +00:00
|
|
|
const [editing,] = useDefinedContext(EditingContext)
|
|
|
|
|
|
|
|
return <>
|
|
|
|
{editing ?
|
|
|
|
<input type="file" value={undefined} {...props}/>
|
|
|
|
: null}
|
|
|
|
<Postcard src={value}/>
|
|
|
|
</>
|
|
|
|
}
|