diff --git a/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx b/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx index 399525a07..b66b4076d 100644 --- a/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx +++ b/packages/gitbook/src/components/SiteSections/SiteSectionList.tsx @@ -82,6 +82,7 @@ export function SiteSectionListItem(props: { href={section.url} aria-current={isActive && 'page'} id={section.id} + data-gb-site-section-id={section.id} className={tcls( 'group/section-link', 'flex', diff --git a/packages/gitbook/src/components/StructurePreview/StructurePreview.tsx b/packages/gitbook/src/components/StructurePreview/StructurePreview.tsx index f7bc86ad5..685c6d5c8 100644 --- a/packages/gitbook/src/components/StructurePreview/StructurePreview.tsx +++ b/packages/gitbook/src/components/StructurePreview/StructurePreview.tsx @@ -9,7 +9,7 @@ import { import type { IconName } from '@gitbook/icons'; import * as React from 'react'; -import { SiteSectionTabs } from '@/components/SiteSections'; +import { SiteSectionList, SiteSectionTabs } from '@/components/SiteSections'; import { TABLE_OF_CONTENTS_SPACES_DROPDOWN_CLASS, getTableOfContentsClassName, @@ -356,18 +356,30 @@ function StructurePreviewSearch() { function StructurePreviewVariantSelector(props: { snapshot: StructurePreviewSnapshot }) { const { snapshot } = props; - const { variants } = snapshot; + const { customization, sections, variants } = snapshot; + const withTopHeader = customization.header.preset !== CustomizationHeaderPreset.None; + const withSections = Boolean( + sections && + (sections.list.length > 1 || + sections.list.some((section) => section.object === 'site-section-group')) + ); + const withSidebarHeader = (!withTopHeader && withSections) || variants.generic.length > 1; return (