Implement drag and drop (#21)
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: https://git.siklos-chaneru.duckdns.org/Siklos/svg-layout-designer-react/pulls/21
This commit is contained in:
Siklos 2022-08-09 06:08:04 -04:00
parent f1e2326073
commit 1fc11adbaa
5 changed files with 172 additions and 45 deletions

View file

@ -17,7 +17,8 @@ interface IUIProps {
SelectContainer: (container: ContainerModel) => void
DeleteContainer: (containerId: string) => void
OnPropertyChange: (key: string, value: string) => void
AddContainer: (type: string) => void
AddContainerToSelectedContainer: (type: string) => void
AddContainer: (index: number, type: string, parentId: string) => void
SaveEditorAsJSON: () => void
SaveEditorAsSVG: () => void
LoadState: (move: number) => void
@ -89,7 +90,7 @@ export class UI extends React.PureComponent<IUIProps, IUIState> {
<Sidebar
componentOptions={this.props.AvailableContainers}
isOpen={this.state.isSidebarOpen}
buttonOnClick={(type: string) => this.props.AddContainer(type)}
buttonOnClick={(type: string) => this.props.AddContainerToSelectedContainer(type)}
/>
<ElementsSidebar
MainContainer={this.props.current.MainContainer}
@ -97,8 +98,9 @@ export class UI extends React.PureComponent<IUIProps, IUIState> {
isOpen={this.state.isElementsSidebarOpen}
isHistoryOpen={this.state.isHistoryOpen}
onPropertyChange={this.props.OnPropertyChange}
selectContainer={this.props.SelectContainer}
deleteContainer={this.props.DeleteContainer}
SelectContainer={this.props.SelectContainer}
DeleteContainer={this.props.DeleteContainer}
AddContainer={this.props.AddContainer}
/>
<History
history={this.props.history}