import React, { SetStateAction } from "react"; import { formatUserLabel } from "../../userLabel"; import { getWidgetComponentWithFallback } from "../../widgets"; import { Field } from "../../widgets/types"; /** * The input to change the primary field value for the new child page. */ export default function PrimaryField({ primary, field, setPrimary, }: { primary: string; setPrimary: (s: SetStateAction) => void; field: Field; }): JSX.Element { const Widget = getWidgetComponentWithFallback(field.type); const value = Widget.deserializeValue ? Widget.deserializeValue(primary, field.type) : primary; return (
{formatUserLabel(field.label_i18n)}
); }