11import { Link , useLocation } from "react-router-dom" ;
22import { cn } from "@/lib/utils" ;
33import { Button } from "@/components/ui/button" ;
4- import { Moon , Sun , Github , Menu , X } from "lucide-react" ;
4+ import { Moon , Sun , Github } from "lucide-react" ;
55import { useState , useEffect } from "react" ;
66
77const navigation = [
@@ -15,15 +15,19 @@ const navigation = [
1515
1616export function Layout ( { children } : { children : React . ReactNode } ) {
1717 const location = useLocation ( ) ;
18- const [ isDark , setIsDark ] = useState ( false ) ;
19- const [ mobileMenuOpen , setMobileMenuOpen ] = useState ( false ) ;
18+ const [ isDark , setIsDark ] = useState ( ( ) => {
19+ const saved = localStorage . getItem ( "theme" ) ;
20+ return saved === "dark" ;
21+ } ) ;
2022
2123 useEffect ( ( ) => {
2224 const root = document . documentElement ;
2325 if ( isDark ) {
2426 root . classList . add ( "dark" ) ;
27+ localStorage . setItem ( "theme" , "dark" ) ;
2528 } else {
2629 root . classList . remove ( "dark" ) ;
30+ localStorage . setItem ( "theme" , "light" ) ;
2731 }
2832 } , [ isDark ] ) ;
2933
@@ -39,24 +43,6 @@ export function Layout({ children }: { children: React.ReactNode }) {
3943 < span className = "font-bold text-lg" > FactoryTools</ span >
4044 </ Link >
4145
42- { /* Desktop Navigation */ }
43- < nav className = "hidden md:flex items-center space-x-6 ml-8" >
44- { navigation . map ( ( item ) => (
45- < Link
46- key = { item . href }
47- to = { item . href }
48- className = { cn (
49- "text-sm font-medium transition-colors hover:text-primary" ,
50- location . pathname === item . href
51- ? "text-primary"
52- : "text-muted-foreground"
53- ) }
54- >
55- { item . name }
56- </ Link >
57- ) ) }
58- </ nav >
59-
6046 < div className = "flex items-center ml-auto space-x-2" >
6147 < Button
6248 variant = "ghost"
@@ -74,47 +60,42 @@ export function Layout({ children }: { children: React.ReactNode }) {
7460 < Github className = "h-5 w-5" />
7561 </ a >
7662 </ Button >
77- < Button
78- variant = "ghost"
79- size = "icon"
80- className = "md:hidden"
81- onClick = { ( ) => setMobileMenuOpen ( ! mobileMenuOpen ) }
82- >
83- { mobileMenuOpen ? < X className = "h-5 w-5" /> : < Menu className = "h-5 w-5" /> }
84- </ Button >
8563 </ div >
8664 </ div >
65+ </ header >
8766
88- { /* Mobile Navigation */ }
89- { mobileMenuOpen && (
90- < nav className = "md:hidden border-t p-4" >
67+ < div className = "flex" >
68+ { /* Left Sidebar */ }
69+ < aside className = "sticky top-14 h-[calc(100vh-3.5rem)] w-64 border-r bg-sidebar overflow-y-auto" >
70+ < nav className = "flex flex-col gap-1 p-4" >
9171 { navigation . map ( ( item ) => (
9272 < Link
9373 key = { item . href }
9474 to = { item . href }
95- onClick = { ( ) => setMobileMenuOpen ( false ) }
9675 className = { cn (
97- "block py-2 text-sm font-medium transition-colors hover:text-primary " ,
76+ "px-3 py-2 rounded-md text-sm font-medium transition-colors" ,
9877 location . pathname === item . href
99- ? "text-primary "
100- : "text-muted -foreground"
78+ ? "bg-sidebar-accent text-sidebar-accent-foreground "
79+ : "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent -foreground"
10180 ) }
10281 >
10382 { item . name }
10483 </ Link >
10584 ) ) }
10685 </ nav >
107- ) }
108- </ header >
86+ </ aside >
10987
110- { /* Main Content */ }
111- < main className = "container mx-auto px-4 py-8" >
112- { children }
113- </ main >
88+ { /* Main Content */ }
89+ < main className = "flex-1 overflow-y-auto" >
90+ < div className = "container mx-auto px-4 py-8 max-w-5xl" >
91+ { children }
92+ </ div >
93+ </ main >
94+ </ div >
11495
11596 { /* Footer */ }
11697 < footer className = "border-t py-6 md:py-0" >
117- < div className = "container mx-auto flex flex-col items-center justify-between gap-4 px-4 md:h-16 md:flex-row" >
98+ < div className = "container mx-auto flex flex-col items-center justify-between gap-4 px-4 md:h-16 md:flex-row ml-64 " >
11899 < p className = "text-sm text-muted-foreground" >
119100 © { new Date ( ) . getFullYear ( ) } LowlandTech. All rights reserved.
120101 </ p >
0 commit comments