Merged PR 162: Implement symbols and other stuff (see desc)

Implement symbols
- Add, Remove, Select Container
- Form
- Link with container
- Symbol behavior application to container (move to x with xpositionreference)

Important changes
- Remove SelectedContainer from HistoryState, meaning that it will be slower for each load but will be faster for each operations* (SetHistory, SelectContainer, DeleteContainer, SymbolOperations)
- ElementsSidebar now opens with isSidebarOpen meaning that both sidebar will open on toggle
- Moved camelize, transformX, restoreX to different modules (stringtools.ts, svg.ts)
This commit is contained in:
Eric Nguyen 2022-08-22 13:58:32 +00:00
parent 58ef28fe89
commit 8b8d88f885
48 changed files with 1453 additions and 188 deletions

View file

@ -0,0 +1,55 @@
import * as React from 'react';
import { IInputGroup } from '../../Interfaces/IInputGroup';
interface ISelectProps {
labelKey?: string
labelText: string
inputKey: string
labelClassName: string
inputClassName: string
inputs: IInputGroup[]
value?: string
onChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void
}
const className = `
w-full
text-xs font-medium transition-all text-gray-800 mt-1 px-3 py-2
bg-white border-2 border-white rounded-lg placeholder-gray-800
focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500
disabled:bg-slate-300 disabled:text-gray-500 disabled:border-slate-300 disabled:shadow-none`;
export const Select: React.FC<ISelectProps> = (props) => {
const options = [(
<option key='symbol-none' value=''>None</option>
)];
props.inputs.forEach(input => {
options.push(<option
key={input.value}
value={input.value}
>
{input.text}
</option>);
});
return (
<>
<label
key={props.labelKey}
className={`mt-4 text-xs font-medium text-gray-800 ${props.labelClassName}`}
htmlFor={props.inputKey}
>
{ props.labelText }
</label>
<select
id={props.inputKey}
value={props.value}
onChange={props.onChange}
className={className}
>
{ options }
</select>
</>
);
};