File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed
Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change 1- import { AppSidebar } from "@/components/sidebar/app-sidebar " ;
1+ import Cookies from "js-cookie " ;
22
3- import { Separator } from "../ui/separator" ;
4- import { SidebarInset , SidebarTrigger } from "../ui/sidebar" ;
5- import { SidebarProvider } from "../ui/sidebar" ;
6- import { AppBreadcrumb } from "./breadcrumb" ;
7- import TrialBanner from "./trial-banner" ;
3+ import { AppBreadcrumb } from "@/components/layouts/breadcrumb" ;
4+ import TrialBanner from "@/components/layouts/trial-banner" ;
5+ import { AppSidebar } from "@/components/sidebar/app-sidebar" ;
6+ import { Separator } from "@/components/ui/separator" ;
7+ import {
8+ SIDEBAR_COOKIE_NAME ,
9+ SidebarInset ,
10+ SidebarProvider ,
11+ SidebarTrigger ,
12+ } from "@/components/ui/sidebar" ;
813
914export default function AppLayout ( { children } : { children : React . ReactNode } ) {
15+ const isSidebarOpen = Cookies . get ( SIDEBAR_COOKIE_NAME ) === "true" ;
16+
1017 return (
11- < SidebarProvider >
18+ < SidebarProvider defaultOpen = { isSidebarOpen } >
1219 < div className = "flex flex-1 flex-col gap-x-1 bg-gray-50 dark:bg-black md:flex-row" >
1320 < AppSidebar />
1421 < SidebarInset className = "ring-1 ring-gray-200 dark:ring-gray-800" >
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import { Slot } from "@radix-ui/react-slot";
44import { VariantProps , cva } from "class-variance-authority" ;
55import { PanelLeft } from "lucide-react" ;
66
7+ import { useIsMobile } from "@/lib/hooks/use-mobile" ;
8+ import { cn } from "@/lib/utils" ;
9+
710import { Button } from "@/components/ui/button" ;
811import { Input } from "@/components/ui/input" ;
912import { Separator } from "@/components/ui/separator" ;
@@ -16,10 +19,7 @@ import {
1619 TooltipTrigger ,
1720} from "@/components/ui/tooltip" ;
1821
19- import { useIsMobile } from "@/lib/hooks/use-mobile" ;
20- import { cn } from "@/lib/utils" ;
21-
22- const SIDEBAR_COOKIE_NAME = "sidebar:state" ;
22+ export const SIDEBAR_COOKIE_NAME = "sidebar:state" ;
2323const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7 ;
2424const SIDEBAR_WIDTH = "16rem" ;
2525const SIDEBAR_WIDTH_MOBILE = "18rem" ;
You can’t perform that action at this time.
0 commit comments