diff --git a/.changeset/weak-swans-battle.md b/.changeset/weak-swans-battle.md new file mode 100644 index 0000000000..b378142000 --- /dev/null +++ b/.changeset/weak-swans-battle.md @@ -0,0 +1,5 @@ +--- +'gitbook': minor +--- + +Fix the styling of site section tabs on smaller screens. diff --git a/packages/gitbook/src/components/Header/Header.tsx b/packages/gitbook/src/components/Header/Header.tsx index 41dcc0b9dd..4c8a8a1e33 100644 --- a/packages/gitbook/src/components/Header/Header.tsx +++ b/packages/gitbook/src/components/Header/Header.tsx @@ -26,10 +26,8 @@ export function Header(props: { context: ContentRefContext; customization: CustomizationSettings | SiteCustomizationSettings; withTopHeader?: boolean; - children?: React.ReactNode; }) { - const { children, context, space, site, spaces, sections, customization, withTopHeader } = - props; + const { context, space, site, spaces, sections, customization, withTopHeader } = props; const isCustomizationDefault = customization.header.preset === CustomizationHeaderPreset.Default; const hasSiteSections = sections && sections.list.length > 1; @@ -145,11 +143,11 @@ export function Header(props: {
-
- -
+
) : null} diff --git a/packages/gitbook/src/components/SiteSectionTabs/SiteSectionTabs.tsx b/packages/gitbook/src/components/SiteSectionTabs/SiteSectionTabs.tsx index fe56a26844..04f81f0da3 100644 --- a/packages/gitbook/src/components/SiteSectionTabs/SiteSectionTabs.tsx +++ b/packages/gitbook/src/components/SiteSectionTabs/SiteSectionTabs.tsx @@ -1,11 +1,10 @@ 'use client'; import { SiteSection } from '@gitbook/api'; -import { Icon } from '@gitbook/icons'; import React from 'react'; import { tcls } from '@/lib/tailwind'; -import { Button, Link } from '../primitives'; +import { Link } from '../primitives'; /** * A set of navigational tabs representing site sections for multi-section sites @@ -35,7 +34,11 @@ export function SiteSectionTabs(props: { if (currentTabRef.current && navRef.current) { const rect = currentTabRef.current.getBoundingClientRect(); const navRect = navRef.current.getBoundingClientRect(); - setTabDimensions({ left: rect.left - navRect.left, width: rect.width }); + + setTabDimensions({ + left: rect.left - navRect.left, + width: rect.width, + }); } }, []); @@ -56,13 +59,11 @@ export function SiteSectionTabs(props: { const scale = (tabDimensions?.width ?? 0) * 0.01; const startPos = `${tabDimensions?.left ?? 0}px`; - const hasMoreSections = false; /** TODO: determine whether we need to show the more button */ - return tabs.length > 0 ? ( ) : null; } @@ -136,16 +142,3 @@ const Tab = React.forwardRef - - - ); -}