'use client'; import { usePathname } from 'next/navigation'; import * as React from 'react'; import { cn } from '../utils'; import { Logo } from './logo'; import { Sidebar } from './sidebar'; interface ShellProps { children: React.ReactNode; } interface ShellContextValue { sidebarToggled: boolean; toggleSidebar: () => void; } export const ShellContext = React.createContext( undefined, ); export const Shell = ({ children }: ShellProps) => { const [sidebarToggled, setSidebarToggled] = React.useState(true); const pathname = usePathname(); // 64rem is the `lg` breakpoint the drawer styles below are keyed to. React.useEffect(() => { if (window.matchMedia('(min-width: 64rem)').matches) return; setSidebarToggled(true); }, [pathname]); return ( setSidebarToggled((v) => !v), sidebarToggled, }} >
{children}
); };