Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/afraid-mirrors-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gitbook": patch
---

Unify section display condition
14 changes: 9 additions & 5 deletions packages/gitbook/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export function Header(props: {
const { context, withTopHeader, withVariants } = props;
const { siteSpace, siteSpaces, sections, customization } = context;

const withSections = Boolean(
sections &&
(sections.list.length > 1 || // Show section tabs if there are at least 2 sections or at least 1 section group
sections.list.some((s) => s.object === 'site-section-group'))
);

return (
<header
id="site-header"
Expand Down Expand Up @@ -144,7 +150,7 @@ export function Header(props: {
</div>

{customization.header.links.length > 0 ||
(!sections && withVariants === 'translations') ? (
(!withSections && withVariants === 'translations') ? (
<HeaderLinks>
{customization.header.links.length > 0 ? (
<>
Expand All @@ -164,7 +170,7 @@ export function Header(props: {
/>
</>
) : null}
{!sections && withVariants === 'translations' ? (
{!withSections && withVariants === 'translations' ? (
<TranslationsDropdown
context={context}
siteSpace={siteSpace}
Expand All @@ -178,9 +184,7 @@ export function Header(props: {
</div>
</div>

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