Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1456251

Browse files
Unify section display condition (#3706)
1 parent f70a2aa commit 1456251

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

‎.changeset/afraid-mirrors-sleep.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+
Unify section display condition

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export function Header(props: {
2323
const { context, withTopHeader, withVariants } = props;
2424
const { siteSpace, siteSpaces, sections, customization } = context;
2525

26+
const withSections = Boolean(
27+
sections &&
28+
(sections.list.length > 1 || // Show section tabs if there are at least 2 sections or at least 1 section group
29+
sections.list.some((s) => s.object === 'site-section-group'))
30+
);
31+
2632
return (
2733
<header
2834
id="site-header"
@@ -144,7 +150,7 @@ export function Header(props: {
144150
</div>
145151

146152
{customization.header.links.length > 0 ||
147-
(!sections && withVariants === 'translations') ? (
153+
(!withSections && withVariants === 'translations') ? (
148154
<HeaderLinks>
149155
{customization.header.links.length > 0 ? (
150156
<>
@@ -164,7 +170,7 @@ export function Header(props: {
164170
/>
165171
</>
166172
) : null}
167-
{!sections && withVariants === 'translations' ? (
173+
{!withSections && withVariants === 'translations' ? (
168174
<TranslationsDropdown
169175
context={context}
170176
siteSpace={siteSpace}
@@ -178,9 +184,7 @@ export function Header(props: {
178184
</div>
179185
</div>
180186

181-
{sections &&
182-
(sections.list.length > 1 || // Show section tabs if there are at least 2 sections or at least 1 section group
183-
sections.list.some((s) => s.object === 'site-section-group')) ? (
187+
{sections && withSections ? (
184188
<div className="transition-[padding] duration-300 lg:chat-open:pr-80 xl:chat-open:pr-96">
185189
<SiteSectionTabs sections={encodeClientSiteSections(context, sections)}>
186190
{withVariants === 'translations' ? (

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /