mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-23 15:14:23 +00:00
15 lines
395 B
TypeScript
15 lines
395 B
TypeScript
import { ReactNode } from "react";
|
|
import { useDefinedContext } from "../../utils/definedContext";
|
|
import { EditingContext } from "./EditingContext";
|
|
|
|
type EditableProps = {
|
|
editing: JSX.Element,
|
|
preview: JSX.Element,
|
|
}
|
|
|
|
|
|
export function Editable({editing, preview}: EditableProps) {
|
|
const [isEditing,] = useDefinedContext(EditingContext)
|
|
|
|
return isEditing ? editing : preview
|
|
}
|