1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-22 22:54:22 +00:00

Document components/generic/editables/base

This commit is contained in:
Steffo 2022-07-18 06:12:11 +02:00
parent c110ae8bf2
commit 8258f8185f
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -1,6 +1,7 @@
import { useDefinedContext } from "../../../utils/definedContext"; import { useDefinedContext } from "../../../utils/definedContext";
import { createStateContext } from "../../../utils/stateContext"; import { createStateContext } from "../../../utils/stateContext";
/** /**
* The mode the editing context is currently in. * The mode the editing context is currently in.
*/ */
@ -16,16 +17,23 @@ export enum EditingMode {
EDIT = "edit", EDIT = "edit",
} }
/** /**
* The context of a previewable `form`. * The context of a previewable `form`.
*/ */
export const EditingContext = createStateContext<EditingMode>() export const EditingContext = createStateContext<EditingMode>()
/**
* Parameters of {@link EditingModeBranch}.
*
* @todo Perhaps this should be changed to callbacks, so that elements are _not_ rendered unless they are required.
*/
export type EditingModeBranchProps = { export type EditingModeBranchProps = {
[Mode in EditingMode]: JSX.Element [Mode in EditingMode]: JSX.Element
} }
/** /**
* Component branching between its props based on the {@link EditingMode} of its innermost surrounding context. * Component branching between its props based on the {@link EditingMode} of its innermost surrounding context.
*/ */