@@ -3,12 +3,16 @@ import { SiteInsightsTrademarkPlacement } from '@gitbook/api';
33import type React from 'react' ;
44
55import { tcls } from '@/lib/tailwind' ;
6+ import { SideSheet } from '../primitives/SideSheet' ;
67import { PagesList } from './PagesList' ;
78import { TOCScrollContainer } from './TOCScroller' ;
89import { TableOfContentsScript } from './TableOfContentsScript' ;
910import { Trademark } from './Trademark' ;
1011import { encodeClientTableOfContents } from './encodeClientTableOfContents' ;
1112
13+ /**
14+ * Sidebar container, responsible for setting the right dimensions and position for the sidebar.
15+ */
1216export async function TableOfContents ( props : {
1317 context : GitBookSiteContext ;
1418 header ?: React . ReactNode ; // Displayed outside the scrollable TOC as a sticky header
@@ -21,23 +25,33 @@ export async function TableOfContents(props: {
2125
2226 return (
2327 < >
24- < aside // Sidebar container, responsible for setting the right dimensions and position for the sidebar.
28+ < SideSheet
29+ side = "left"
2530 data-testid = "table-of-contents"
2631 id = "table-of-contents"
32+ toggleClass = "navigation-open"
33+ withShim = { true }
34+ withCloseButton = { true }
2735 className = { tcls (
28- 'group' ,
36+ 'group/table-of-contents ' ,
2937 'text-sm' ,
3038
3139 'grow-0' ,
3240 'shrink-0' ,
33- 'basis-full' ,
34- 'lg:basis-72' ,
41+
42+ 'max-w-72' ,
43+ 'basis-72' ,
3544 'lg:page-no-toc:basis-56' ,
3645
37- 'relative' ,
38- 'z-1' ,
46+ 'max-lg:not-sidebar-filled:bg-tint-base' ,
47+ 'max-lg:not-sidebar-filled:border-r' ,
48+ 'border-tint-subtle' ,
49+
50+ 'lg:flex!' ,
51+ 'lg:animate-none!' ,
3952 'lg:sticky' ,
4053 'lg:mr-12' ,
54+ 'max-lg:pl-3' ,
4155
4256 // Server-side static positioning
4357 'lg:top-0' ,
@@ -59,22 +73,12 @@ export async function TableOfContents(props: {
5973 'lg:page-no-toc:[html[style*="--outline-top-offset"]_&]:top-(--outline-top-offset)!' ,
6074 'lg:page-no-toc:[html[style*="--outline-height"]_&]:top-(--outline-height)!' ,
6175
62- 'pt-4' ,
63- 'pb-4' ,
76+ 'py-4' ,
6477 'lg:sidebar-filled:pr-6' ,
6578 'lg:page-no-toc:pr-0' ,
6679
67- 'hidden' ,
68- 'navigation-open:flex!' ,
69- 'lg:flex' ,
70- 'lg:page-no-toc:hidden' ,
71- 'xl:page-no-toc:flex' ,
72- 'lg:site-header-none:page-no-toc:flex' ,
7380 'flex-col' ,
74- 'gap-4' ,
75-
76- 'navigation-open:border-b' ,
77- 'border-tint-subtle'
81+ 'gap-4'
7882 ) }
7983 >
8084 { header && header }
@@ -122,7 +126,7 @@ export async function TableOfContents(props: {
122126 ) : null }
123127 </ TOCScrollContainer >
124128 </ div >
125- </ aside >
129+ </ SideSheet >
126130 < TableOfContentsScript />
127131 </ >
128132 ) ;
0 commit comments