import * as React from 'react'; import ContainerProperties from '../../Interfaces/Properties'; interface IPropertiesProps { properties?: ContainerProperties onChange: (key: string, value: string) => void } export const Properties: React.FC = (props: IPropertiesProps) => { if (props.properties === undefined) { return
; } const groupInput: React.ReactNode[] = []; Object .entries(props.properties) .forEach((pair) => handleProperties(pair, groupInput, props.onChange)); return (
{ groupInput }
); }; const handleProperties = ( [key, value]: [string, string | number], groupInput: React.ReactNode[], onChange: (key: string, value: string) => void ): void => { const id = `property-${key}`; const type = 'text'; const isDisabled = key === 'id' || key === 'parentId'; // hardcoded groupInput.push(
onChange(key, event.target.value)} disabled={isDisabled} />
); };