@@ -74,7 +74,9 @@ function SidebarProvider({
7474 // Restore sidebar state from cookie on mount
7575 React . useEffect ( ( ) => {
7676 try {
77- const cookies = document . cookie . split ( '; ' ) . find ( row => row . startsWith ( SIDEBAR_COOKIE_NAME + '=' ) ) ;
77+ const cookies = document . cookie
78+ . split ( '; ' )
79+ . find ( ( row ) => row . startsWith ( SIDEBAR_COOKIE_NAME + '=' ) ) ;
7880 if ( cookies ) {
7981 const savedState = cookies . split ( '=' ) [ 1 ] === 'true' ;
8082 _setOpen ( savedState ) ;
@@ -96,9 +98,7 @@ function SidebarProvider({
9698 // This sets the cookie to keep the sidebar state.
9799 try {
98100 document . cookie = `${ SIDEBAR_COOKIE_NAME } =${ openState } ; path=/; max-age=${ SIDEBAR_COOKIE_MAX_AGE } ` ;
99- } catch {
100-
101- }
101+ } catch { }
102102 } ,
103103 [ setOpenProp , open ] ,
104104 ) ;
@@ -124,7 +124,6 @@ function SidebarProvider({
124124 return ( ) => window . removeEventListener ( 'keydown' , handleKeyDown ) ;
125125 } , [ toggleSidebar ] ) ;
126126
127-
128127 const state = open ? 'expanded' : 'collapsed' ;
129128
130129 const contextValue = React . useMemo < SidebarContextProps > (
@@ -247,7 +246,7 @@ function Sidebar({
247246 side === 'left'
248247 ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
249248 : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]' ,
250-
249+
251250 variant === 'floating' || variant === 'inset'
252251 ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
253252 : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l' ,
@@ -441,7 +440,7 @@ function SidebarGroupAction({
441440 data-sidebar = "group-action"
442441 className = { cn (
443442 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0' ,
444-
443+
445444 'after:absolute after:-inset-2 md:after:hidden' ,
446445 'group-data-[collapsible=icon]:hidden' ,
447446 className ,
@@ -576,7 +575,7 @@ function SidebarMenuAction({
576575 data-sidebar = "menu-action"
577576 className = { cn (
578577 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0' ,
579-
578+
580579 'after:absolute after:-inset-2 md:after:hidden' ,
581580 'peer-data-[size=sm]/menu-button:top-1' ,
582581 'peer-data-[size=default]/menu-button:top-1.5' ,
@@ -620,7 +619,6 @@ function SidebarMenuSkeleton({
620619} : React . ComponentProps < 'div' > & {
621620 showIcon ?: boolean ;
622621} ) {
623-
624622 const width = React . useMemo ( ( ) => {
625623 return `${ Math . floor ( Math . random ( ) * 40 ) + 50 } %` ;
626624 } , [ ] ) ;
0 commit comments