Merged PR 163: Remove the static form + rename some components for clarity
All checks were successful
continuous-integration/drone/push Build is passing

The static form is hard to maintain so I am removing it + rename some components for clarity + moved some utils files
This commit is contained in:
Eric Nguyen 2022-08-22 14:37:25 +00:00
parent 7e3ccdee99
commit 66ea3b1b64
21 changed files with 150 additions and 523 deletions

View file

@ -1,56 +0,0 @@
import * as React from 'react';
import { ISymbolModel } from '../../Interfaces/ISymbolModel';
import { restoreX, transformX } from '../../utils/svg';
import { InputGroup } from '../InputGroup/InputGroup';
interface IDynamicFormProps {
symbol: ISymbolModel
symbols: Map<string, ISymbolModel>
onChange: (key: string, value: string | number | boolean) => void
}
const DynamicForm: React.FunctionComponent<IDynamicFormProps> = (props) => {
return (
<div className='grid grid-cols-2 gap-y-4'>
<InputGroup
labelText='Name'
inputKey='id'
labelClassName=''
inputClassName=''
type='string'
value={props.symbol.id.toString()}
isDisabled={true}
/>
<InputGroup
labelText='x'
inputKey='x'
labelClassName=''
inputClassName=''
type='number'
value={transformX(props.symbol.x, props.symbol.width, props.symbol.config.XPositionReference).toString()}
onChange={(event) => props.onChange('x', restoreX(Number(event.target.value), props.symbol.width, props.symbol.config.XPositionReference))}
/>
<InputGroup
labelText='Height'
inputKey='height'
labelClassName=''
inputClassName=''
type='number'
min={0}
value={props.symbol.height.toString()}
onChange={(event) => props.onChange('height', Number(event.target.value))}
/>
<InputGroup
labelText='Width'
inputKey='width'
labelClassName=''
inputClassName=''
type='number'
min={0}
value={props.symbol.width.toString()}
onChange={(event) => props.onChange('width', Number(event.target.value))}
/>
</div>
);
};
export default DynamicForm;