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

16 lines
401 B
TypeScript
Raw Normal View History

2022-06-08 17:14:00 +00:00
import { ReactNode } from "react";
import { useDefinedContext } from "../../utils/definedContext";
import { EditingContext } from "./EditingContext";
type EditableProps = {
editing: JSX.Element,
preview: JSX.Element,
}
2022-06-10 15:18:36 +00:00
export function BaseEditable({ editing, preview }: EditableProps) {
2022-06-08 17:14:00 +00:00
const [isEditing,] = useDefinedContext(EditingContext)
return isEditing ? editing : preview
}