Create sidebar
This commit is contained in:
parent
60dc0b56bb
commit
adf86ebea1
4 changed files with 44 additions and 8 deletions
16
src/App.tsx
16
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<IAppProps> {
|
||||
|
@ -18,6 +18,7 @@ class App extends React.Component<IAppProps> {
|
|||
constructor(props: IAppProps) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isSidebarOpen: true,
|
||||
componentOptions: []
|
||||
};
|
||||
}
|
||||
|
@ -25,15 +26,24 @@ class App extends React.Component<IAppProps> {
|
|||
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 (
|
||||
<div className="App">
|
||||
<Sidebar componentOptions={this.state.componentOptions} />
|
||||
<div className="App font-sans h-full">
|
||||
<Sidebar componentOptions={this.state.componentOptions} isOpen={this.state.isSidebarOpen} onClick={() => this.ToggleMenu()} />
|
||||
<button className='fixed z-0 top-4 left-4 text-lg' onClick={() => this.ToggleMenu()}>☰ Menu</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue