Skip to content

Commit e05f262

Browse files
committed
Get ready for supporting side sections list
(not enabled for now)
1 parent f53e042 commit e05f262

File tree

3 files changed

+36
-41
lines changed

3 files changed

+36
-41
lines changed

packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -141,42 +141,40 @@ export function SpaceLayout(props: SpaceLayoutProps) {
141141
<TableOfContents
142142
context={context}
143143
header={
144-
withTopHeader ? null : (
145-
<div
146-
className={tcls(
147-
'hidden',
148-
'pr-4',
149-
'mt-2',
150-
'lg:flex',
151-
'grow-0',
152-
'dark:shadow-light/1',
153-
'text-base/tight',
154-
'items-center'
155-
)}
156-
>
157-
<HeaderLogo context={context} />
158-
{variants.translations.length > 1 ? (
159-
<TranslationsDropdown
160-
context={context}
161-
siteSpace={
162-
variants.translations.find(
163-
(space) => space.id === siteSpace.id
164-
) ?? siteSpace
165-
}
166-
siteSpaces={variants.translations}
167-
className="[&_.button-leading-icon]:block! ml-auto py-2 [&_.button-content]:hidden"
168-
/>
169-
) : null}
170-
</div>
171-
)
144+
<div
145+
className={tcls(
146+
'pr-4',
147+
'mt-2',
148+
'flex',
149+
withTopHeader ? 'lg:hidden' : '',
150+
'grow-0',
151+
'dark:shadow-light/1',
152+
'text-base/tight',
153+
'items-center'
154+
)}
155+
>
156+
<HeaderLogo context={context} />
157+
{variants.translations.length > 1 ? (
158+
<TranslationsDropdown
159+
context={context}
160+
siteSpace={
161+
variants.translations.find(
162+
(space) => space.id === siteSpace.id
163+
) ?? siteSpace
164+
}
165+
siteSpaces={variants.translations}
166+
className="[&_.button-leading-icon]:block! ml-auto py-2 [&_.button-content]:hidden"
167+
/>
168+
) : null}
169+
</div>
172170
}
173171
// Displays the search button and/or the space dropdown in the ToC
174172
// according to the header/variant settings.
175173
// E.g if there is no header, the search button will be displayed in the ToC.
176174
innerHeader={
177175
<>
178176
{!withTopHeader && (
179-
<div className="flex gap-2">
177+
<div className="flex gap-2 max-lg:hidden">
180178
<SearchContainer
181179
style={CustomizationSearchStyle.Subtle}
182180
withVariants={variants.generic.length > 1}

packages/gitbook/src/components/TableOfContents/TableOfContents.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function TableOfContents(props: {
3030
data-testid="table-of-contents"
3131
id="table-of-contents"
3232
toggleClass="navigation-open"
33-
withShim={true}
33+
withScrim={true}
3434
withCloseButton={true}
3535
className={tcls(
3636
'group/table-of-contents',
@@ -51,7 +51,6 @@ export async function TableOfContents(props: {
5151
'lg:animate-none!',
5252
'lg:sticky',
5353
'lg:mr-12',
54-
'max-lg:pl-3',
5554

5655
// Server-side static positioning
5756
'lg:top-0',
@@ -73,18 +72,20 @@ export async function TableOfContents(props: {
7372
'lg:page-no-toc:[html[style*="--outline-top-offset"]_&]:top-(--outline-top-offset)!',
7473
'lg:page-no-toc:[html[style*="--outline-height"]_&]:top-(--outline-height)!',
7574

76-
'py-4',
75+
'pt-6',
76+
'pb-4',
7777
'lg:sidebar-filled:pr-6',
7878
'lg:page-no-toc:pr-0',
79+
'max-lg:pl-8',
7980

8081
'flex-col',
8182
'gap-4'
8283
)}
8384
>
84-
{header && header}
85+
{header ? header : null}
8586
<div // The actual sidebar, either shown with a filled bg or transparent.
8687
className={tcls(
87-
'lg:-ms-5',
88+
'-ms-5',
8889
'relative flex grow flex-col overflow-hidden border-tint-subtle',
8990

9091
'sidebar-filled:bg-tint-subtle',
@@ -102,15 +103,10 @@ export async function TableOfContents(props: {
102103
)}
103104
>
104105
{innerHeader ? (
105-
<div className="my-4 flex flex-col space-y-4 px-5 empty:hidden">
106-
{innerHeader}
107-
</div>
106+
<div className="flex flex-col gap-4 px-5 empty:hidden">{innerHeader}</div>
108107
) : null}
109108
<TOCScrollContainer // The scrollview inside the sidebar
110-
className={tcls(
111-
'flex grow flex-col p-2 pt-4',
112-
'hide-scrollbar overflow-y-auto'
113-
)}
109+
className={tcls('flex grow flex-col p-2', 'hide-scrollbar overflow-y-auto')}
114110
>
115111
<PagesList
116112
pages={pages}

packages/gitbook/src/components/TableOfContents/Trademark.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function Trademark(props: {
2323
'inset-x-0',
2424
'-bottom-2',
2525
'-mb-2',
26+
'sidebar-filled:pb-2',
2627

2728
'pointer-events-none',
2829

0 commit comments

Comments
 (0)