@@ -6,73 +6,71 @@ import { FilterPresenter } from "../presenters/FilterPresenter.jsx";
66import { Routes , Route } from 'react-router-dom' ;
77import SharedView from '../pages/SharedView.jsx' ;
88import { slide as Menu } from 'react-burger-menu' ;
9+ import { observer } from 'mobx-react-lite' ;
10+
911
10- function MainAppLayout ( { model } ) {
11- const [ sidebarIsOpen , setSidebarIsOpen ] = useState ( true ) ;
1212
13- const toggleSidebar = ( ) => {
14- setSidebarIsOpen ( ! sidebarIsOpen ) ;
15- }
13+ function MainAppLayout ( { model } ) {
1614
15+ const [ sidebarIsOpen , setSidebarIsOpen ] = useState ( model . sidebarIsOpen ) ;
1716
1817 return (
1918 /* The sidebar styling(under the menu)*/
2019 < div className = " flex h-screen w-screen bg-[#6246a8] " >
2120 { /* If sidebar is open, set length to 400px, else it should not be visible */ }
2221 < div className = { `${ sidebarIsOpen ? 'w-[400px]' : 'w-0' } ` } >
2322 < Menu
24- width = { 400 } // menu width
25- isOpen = { sidebarIsOpen }
23+ width = { 400 }
24+ isOpen = { model . sidebarIsOpen }
2625 onStateChange = { ( state ) => setSidebarIsOpen ( state . isOpen ) }
27- className = "bg-gradient-to-t from-[#6246a8] to-[#6747c0] z-0 h-screen" // The menu styling
26+ className = "bg-gradient-to-t from-[#6246a8] to-[#6747c0] z-0 h-screen"
2827 noOverlay
2928 styles = { {
3029 bmMenuWrap : {
3130 zIndex : '10'
32- }
31+ } ,
32+ bmBurgerButton : {
33+ position : 'fixed' ,
34+ top : '20px' ,
35+ left : '20px' ,
36+ width : '36px' ,
37+ height : '30px'
38+ } ,
3339 } }
40+ customBurgerIcon = { < img src = "https://img.icons8.com/ios-filled/50/ffffff/menu-2.png" /> }
3441 >
35- { /* The menu contents */ }
36- < SidebarPresenter model = { model } />
42+ < SidebarPresenter model = { model } />
3743 </ Menu >
3844 </ div >
3945
46+
47+
4048 < div className = "flex-1 h-full flex flex-col " >
4149
50+
4251 < div className = "bg-gradient-to-t from-[#6246a8] to-[#6747c0] text-white" >
4352 < div className = "flex items-center" >
44- { /* The button to open the menu */ }
45- < button
46- onClick = { toggleSidebar }
47- className = "p-2 ml-2 text-white hover:bg-purple-700 rounded"
48- >
49- < img
50- src = "https://img.icons8.com/ios-filled/50/ffffff/menu-2.png"
51- alt = "menu icon"
52- className = "w-6 h-6"
53- />
54- </ button >
55- < SearchbarPresenter model = { model } />
53+ < SearchbarPresenter model = { model } />
5654 </ div >
5755 </ div >
5856
5957
6058 < div className = "flex-auto border bg-[#121212] relative" >
61- < ListViewPresenter model = { model } />
59+ < ListViewPresenter model = { model } />
6260 </ div >
6361
64- < FilterPresenter model = { model } />
62+ < FilterPresenter model = { model } />
6563 </ div >
6664 </ div > )
6765}
6866
69- function App ( { model } ) {
67+ function App ( { model} ) {
7068 return (
7169 < Routes >
72- < Route path = "/" element = { < MainAppLayout model = { model } /> } />
73- < Route path = "/share" element = { < SharedView model = { model } /> } />
70+ < Route path = "/" element = { < MainAppLayout model = { model } /> } />
71+ < Route path = "/share" element = { < SharedView model = { model } /> } />
7472 </ Routes >
7573 ) ;
7674}
7775
78- export default App ;
76+ export default observer ( App ) ;
0 commit comments