Compare commits

..

No commits in common. "b2a020730cef080ec45c458f8377c58cd583b5e7" and "106c403125e77d8f064010bd7a680c2c2420e682" have entirely different histories.

2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import './App.scss'; import './App.scss';
import Sidebar from './Components/Sidebar/Sidebar'; import Sidebar from './Components/Sidebar/Sidebar';
import { ElementsSidebar } from './Components/ElementsSidebar/ElementsSidebar'; import { SVGSidebar } from './Components/SVGSidebar/SVGSidebar';
import { AvailableContainer } from './Interfaces/AvailableContainer'; import { AvailableContainer } from './Interfaces/AvailableContainer';
import { Configuration } from './Interfaces/Configuration'; import { Configuration } from './Interfaces/Configuration';
import { Container } from './Components/SVG/Elements/Container'; import { Container } from './Components/SVG/Elements/Container';
@ -133,7 +133,7 @@ class App extends React.Component<IAppProps> {
buttonOnClick={(type: string) => this.AddContainer(type)} buttonOnClick={(type: string) => this.AddContainer(type)}
/> />
<button className='fixed z-10 top-4 left-4 text-lg bg-blue-200 hover:bg-blue-300 transition-all drop-shadow-md hover:drop-shadow-lg py-2 px-3 rounded-lg' onClick={() => this.ToggleSidebar()}>&#9776; Menu</button> <button className='fixed z-10 top-4 left-4 text-lg bg-blue-200 hover:bg-blue-300 transition-all drop-shadow-md hover:drop-shadow-lg py-2 px-3 rounded-lg' onClick={() => this.ToggleSidebar()}>&#9776; Menu</button>
<ElementsSidebar <SVGSidebar
MainContainer={this.state.MainContainer} MainContainer={this.state.MainContainer}
SelectedContainer={this.state.SelectedContainer} SelectedContainer={this.state.SelectedContainer}
isOpen={this.state.isSVGSidebarOpen} isOpen={this.state.isSVGSidebarOpen}

View file

@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import { Container } from '../SVG/Elements/Container'; import { Container } from '../SVG/Elements/Container';
interface IElementsSidebarProps { interface ISVGSidebarProps {
MainContainer: Container | null, MainContainer: Container | null,
isOpen: boolean, isOpen: boolean,
SelectedContainer: Container | null, SelectedContainer: Container | null,
@ -9,7 +9,7 @@ interface IElementsSidebarProps {
selectContainer: (container: Container) => void selectContainer: (container: Container) => void
} }
export class ElementsSidebar extends React.Component<IElementsSidebarProps> { export class SVGSidebar extends React.Component<ISVGSidebarProps> {
public iterateChilds(handleContainer: (container: Container, depth: number) => void): React.ReactNode { public iterateChilds(handleContainer: (container: Container, depth: number) => void): React.ReactNode {
// TODO: fix this by using dfs or sort // TODO: fix this by using dfs or sort
const root = this.props.MainContainer; const root = this.props.MainContainer;
@ -49,7 +49,7 @@ export class ElementsSidebar extends React.Component<IElementsSidebarProps> {
const text = '\t\t'.repeat(depth) + key; const text = '\t\t'.repeat(depth) + key;
const selectedClass: string = this.props.SelectedContainer !== null && const selectedClass: string = this.props.SelectedContainer !== null &&
this.props.SelectedContainer.props.id === container.props.id this.props.SelectedContainer.props.id === container.props.id
? 'bg-blue-500 hover:bg-blue-600' ? 'bg-blue-500 hover:bg-slate-500'
: 'bg-slate-400 hover:bg-slate-600'; : 'bg-slate-400 hover:bg-slate-600';
containerRows.push( containerRows.push(
<button className={`sidebar-row whitespace-pre text-left transition-all ${selectedClass}`} key={key} onClick={() => this.props.selectContainer(container)}> <button className={`sidebar-row whitespace-pre text-left transition-all ${selectedClass}`} key={key} onClick={() => this.props.selectContainer(container)}>