File tree Expand file tree Collapse file tree 7 files changed +77
-16
lines changed Expand file tree Collapse file tree 7 files changed +77
-16
lines changed Original file line number Diff line number Diff line change 4646 height : 100% ;
4747}
4848
49+ @media (max-width : 800px ) {
50+ .app-container {
51+ flex-direction : column;
52+ }
53+ }
54+
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export function App() {
1515 const [ loading , setLoading ] = useState ( true ) ;
1616 const [ sidebar , setSidebar ] = useState ( [ ] ) ;
1717 const [ editUrl , setEditUrl ] = useState ( null ) ;
18+ const [ sidebarVisible , setSidebarVisible ] = useState ( false ) ;
1819
1920 const { getTopics, getContent } = useApi ( ) ;
2021
@@ -42,10 +43,11 @@ export function App() {
4243
4344 return ( < >
4445 < div className = "app" >
45- < Navbar />
46+ < Navbar toggleActive = { ( ) => setSidebarVisible ( ! sidebarVisible ) } />
4647
4748 < div className = "app-container" >
4849 < Sidebar
50+ active = { sidebarVisible }
4951 contents = { sidebar }
5052 switchContent = { switchContent }
5153 />
Original file line number Diff line number Diff line change 185185 color : var (--color-text-secondary );
186186}
187187
188+ @media (max-width : 800px ) {
189+ .content {
190+ padding : 2rem ;
191+ }
192+ }
193+
Original file line number Diff line number Diff line change 1- import { Home } from "lucide-react" ;
1+ import { Hamburger , Home } from "lucide-react" ;
22import Logo from "../../assets/GraphScript.png" ;
33import "./style.css" ;
44
5- export function Navbar ( ) {
5+ export function Navbar ( { toggleActive } ) {
66 return ( < >
77 < nav className = "navbar" >
88 < div className = "navbar-container" >
@@ -11,12 +11,15 @@ export function Navbar() {
1111 < h1 className = "navbar-title" > GraphScript Docs</ h1 >
1212 </ div >
1313
14- < a
15- href = "/"
16- className = "navbar-home"
17- >
18- < Home />
19- </ a >
14+ < div className = "navbar-actions" >
15+ < span className = "navbar-sidebar-hamburger" onClick = { toggleActive } >
16+ < Hamburger />
17+ </ span >
18+
19+ < a href = "/" className = "navbar-home" >
20+ < Home />
21+ </ a >
22+ </ div >
2023 </ div >
2124 </ nav >
2225 </ > ) ;
Original file line number Diff line number Diff line change 3939 width : auto;
4040}
4141
42- .navbar-home {
42+ .navbar-actions {
43+ display : flex;
44+ align-items : center;
45+ gap : 0.5rem ;
46+ height : 100% ;
47+ }
48+
49+ .navbar-actions > * {
4350 z-index : 1000 ;
4451 padding : 0.5rem ;
52+ height : 100% ;
4553 aspect-ratio : 1 ;
46- width : 2rem ;
4754 display : flex;
4855 align-items : center;
4956 justify-content : center;
5562 color : var (--color-gradient );
5663}
5764
58- .navbar-home : hover {
65+ : has (.sidebar-wrapper .active ) .navbar-sidebar-hamburger ,
66+ .navbar-actions > * : hover {
5967 opacity : 1 ;
6068 box-shadow : 0 0 0.5rem # ffffff33 ;
6169}
6270
63- .navbar-home : active {
71+ .navbar-actions > * : active {
6472 scale : 0.5 ;
6573}
6674
67- .navbar-home > * {
75+ .navbar-actions > * > * {
6876 width : 100% ;
6977 height : 100% ;
7078}
7179
80+ .navbar-sidebar-hamburger {
81+ display : none;
82+ }
83+
84+ @media (max-width : 800px ) {
85+ .navbar-sidebar-hamburger {
86+ display : flex;
87+ }
88+ }
89+
Original file line number Diff line number Diff line change 11import { SidebarItem } from "../SidebarItem" ;
22import "./style.css" ;
33
4- export function Sidebar ( { contents, switchContent } ) {
4+ export function Sidebar ( { active , contents, switchContent } ) {
55 return ( < >
6- < div className = "sidebar-wrapper" >
6+ < div className = { [
7+ "sidebar-wrapper" ,
8+ active ? "active" : ""
9+ ] . join ( " " ) } >
710 < div className = "sidebar" >
811 {
912 contents . map ( section => < div
Original file line number Diff line number Diff line change 11.sidebar-wrapper {
22 flex : 1 ;
3+ min-width : 20rem ;
34 margin : 2rem ;
45 overflow : hidden;
56 border-radius : 1rem ;
67 background : var (--gradient );
78 color : var (--color-gradient );
9+ position : relative;
810}
911
1012.sidebar {
4143 gap : 0.5rem ;
4244}
4345
46+ @media (max-width : 800px ) {
47+ .sidebar-wrapper {
48+ z-index : 2000 ;
49+ top : 4rem ;
50+ left : 2rem ;
51+ position : fixed;
52+ min-width : none;
53+ width : calc (100vw - 4rem );
54+ height : calc (100% - 5rem );
55+ flex : auto;
56+ margin : 0 ;
57+ pointer-events : none;
58+ transform : translateY (-50% ) scale (0 );
59+ }
60+
61+ .sidebar-wrapper .active {
62+ pointer-events : auto;
63+ transform : translateY (0 ) scale (1 );
64+ }
65+ }
66+
You can’t perform that action at this time.
0 commit comments