Skip to content

Commit e35e40e

Browse files
committed
Show section tabs when there is a single section group present
1 parent 07eab98 commit e35e40e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.changeset/modern-adults-scream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gitbook": patch
3+
---
4+
5+
Show tabs when there is a single section group present

packages/gitbook/src/components/Header/Header.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,13 @@ export function Header(props: { context: GitBookSiteContext; withTopHeader?: boo
211211
/>
212212
</div>
213213
)}
214-
{sections && sections.list.length > 1 && (
215-
<SiteSectionTabs
216-
sections={encodeClientSiteSections(context, sections)}
217-
/>
218-
)}
214+
{sections &&
215+
(sections.list.some((s) => s.object === 'site-section-group') || // If there's even a single group, show the tabs
216+
sections.list.length > 1) && ( // Otherwise, show the tabs if there's more than one section
217+
<SiteSectionTabs
218+
sections={encodeClientSiteSections(context, sections)}
219+
/>
220+
)}
219221
</div>
220222
</div>
221223
</div>

0 commit comments

Comments
 (0)