import Stack from '@mui/material/Stack'; import TextField from '@mui/material/TextField'; import { createPropertyGroup } from '../api/language/propertyGroup.api'; import CreateEntityDialog from './CreateEntityDialog'; import type { PropertyGroup } from '../data/propertyGroup'; type PropertyGroupCreateDialogProps = { open: boolean; onClose: () => void; onCreated: (propertyGroup: PropertyGroup) => void | Promise; }; type PropertyGroupFormState = { label: string; description: string; }; const initialFormState: PropertyGroupFormState = { label: '', description: '', }; const PropertyGroupCreateDialog = ({ open, onClose, onCreated }: PropertyGroupCreateDialogProps) => { return ( createPropertyGroup({ id: 0, label: formState.label, description: formState.description })} errorMessageText="Creating the property group failed." > {({ formState, setFormState }) => ( setFormState((currentState) => ({ ...currentState, label: event.target.value }))} /> setFormState((currentState) => ({ ...currentState, description: event.target.value }))} /> )} ); }; export default PropertyGroupCreateDialog;