mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-23 07:04:22 +00:00
14 lines
No EOL
418 B
TypeScript
14 lines
No EOL
418 B
TypeScript
import { HTMLProps } from "react";
|
|
import { EditingContext } from "../../contexts/editing";
|
|
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>
|
|
)
|
|
} |