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

14 lines
415 B
TypeScript
Raw Normal View History

2022-06-04 03:13:19 +00:00
import { HTMLProps } from "react";
2022-06-08 15:38:30 +00:00
import { EditingContext } from "../contexts/editing";
2022-06-04 03:13:19 +00:00
import { useDefinedContext } from "../../utils/definedContext";
export function EditableText({value, ...props}: HTMLProps<HTMLInputElement>) {
const [editing,] = useDefinedContext(EditingContext)
return editing ? (
<input type="text" value={value} {...props}/>
) : (
<span>{value}</span>
)
}