Skip to content

Commit 3bfe347

Browse files
authored
Show section tabs when there is a single section group present (#3387)
1 parent 7b38f89 commit 3bfe347

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
@@ -226,11 +226,13 @@ export function Header(props: {
226226
/>
227227
</div>
228228
)}
229-
{sections && sections.list.length > 1 && (
230-
<SiteSectionTabs
231-
sections={encodeClientSiteSections(context, sections)}
232-
/>
233-
)}
229+
{sections &&
230+
(sections.list.some((s) => s.object === 'site-section-group') || // If there's even a single group, show the tabs
231+
sections.list.length > 1) && ( // Otherwise, show the tabs if there's more than one section
232+
<SiteSectionTabs
233+
sections={encodeClientSiteSections(context, sections)}
234+
/>
235+
)}
234236
</div>
235237
</div>
236238
</div>

0 commit comments

Comments
 (0)