diff --git a/src/App.scss b/src/App.scss index e69de29..4134015 100644 --- a/src/App.scss +++ b/src/App.scss @@ -0,0 +1,5 @@ +html, +body, +#root { + height: 100%; +} \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index 4ddef0f..ece4711 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,11 +5,11 @@ import { IAvailableContainerModel } from './Interfaces/IAvailableContainerModel' import { IConfigurationResponseModel } from './Interfaces/IConfigurationResponseModel'; interface IAppProps { - } interface IAppState { componentOptions: IAvailableContainerModel[] + isSidebarOpen: boolean } class App extends React.Component { @@ -18,6 +18,7 @@ class App extends React.Component { constructor(props: IAppProps) { super(props); this.state = { + isSidebarOpen: true, componentOptions: [] }; } @@ -25,15 +26,24 @@ class App extends React.Component { componentDidMount() { fetchConfiguration().then((configuration: IConfigurationResponseModel) => { this.setState({ + isSidebarOpen: this.state.isSidebarOpen, componentOptions: configuration.AvailableContainers }); }); } + public ToggleMenu() { + this.setState({ + isSidebarOpen: !this.state.isSidebarOpen, + componentOptions: this.state.componentOptions + }); + } + render() { return ( -
- +
+ this.ToggleMenu()} /> +
); } diff --git a/src/Components/Sidebar/Sidebar.tsx b/src/Components/Sidebar/Sidebar.tsx index 62da392..8ca7e16 100644 --- a/src/Components/Sidebar/Sidebar.tsx +++ b/src/Components/Sidebar/Sidebar.tsx @@ -3,14 +3,29 @@ import { IAvailableContainerModel } from '../../Interfaces/IAvailableContainerMo interface ISidebarProps { componentOptions: IAvailableContainerModel[] + isOpen: boolean; + onClick: () => void; } -export default class Sidebar extends React.PureComponent { +export default class Sidebar extends React.Component { public render() { - return ( - + const isOpenClasses = this.props.isOpen ? 'left-0' : '-left-64'; + return ( +
+
+ +
+
+ Composants +
+ {listElements} +
); } } diff --git a/src/index.css b/src/index.css index bd6213e..29f3840 100644 --- a/src/index.css +++ b/src/index.css @@ -1,3 +1,9 @@ @tailwind base; @tailwind components; -@tailwind utilities; \ No newline at end of file +@tailwind utilities; + +@layer components { + .sidebar-row { + @apply p-6 w-full + } +} \ No newline at end of file