11'use client' ;
22import { SiteSection } from '@gitbook/api' ;
3- import { Icon } from '@gitbook/icons' ;
43import React from 'react' ;
54
65import { tcls } from '@/lib/tailwind' ;
76
8- import { Button , Link } from '../primitives' ;
7+ import { Link } from '../primitives' ;
98
109/**
1110 * A set of navigational tabs representing site sections for multi-section sites
@@ -35,7 +34,11 @@ export function SiteSectionTabs(props: {
3534 if ( currentTabRef . current && navRef . current ) {
3635 const rect = currentTabRef . current . getBoundingClientRect ( ) ;
3736 const navRect = navRef . current . getBoundingClientRect ( ) ;
38- setTabDimensions ( { left : rect . left - navRect . left , width : rect . width } ) ;
37+
38+ setTabDimensions ( {
39+ left : rect . left - navRect . left ,
40+ width : rect . width ,
41+ } ) ;
3942 }
4043 } , [ ] ) ;
4144
@@ -56,13 +59,11 @@ export function SiteSectionTabs(props: {
5659 const scale = ( tabDimensions ?. width ?? 0 ) * 0.01 ;
5760 const startPos = `${ tabDimensions ?. left ?? 0 } px` ;
5861
59- const hasMoreSections = false ; /** TODO: determine whether we need to show the more button */
60-
6162 return tabs . length > 0 ? (
6263 < nav
6364 aria-label = "Sections"
6465 ref = { navRef }
65- className = "flex flex-nowrap items-center max-w-screen mb-px"
66+ className = "flex flex-nowrap items-center mb-px"
6667 style = {
6768 {
6869 '--tab-opacity' : `${ opacity } ` ,
@@ -77,6 +78,12 @@ export function SiteSectionTabs(props: {
7778 'flex' ,
7879 'gap-2' ,
7980 'bg-transparent' ,
81+
82+ // Horizontal padding, which is the layout padding minus the padding of the tabs themselves.
83+ 'px-1' ,
84+ 'sm:px-3' ,
85+ 'md:px-5' ,
86+
8087 /* add a pseudo element for active tab indicator */
8188 'after:block' ,
8289 "after:content-['']" ,
@@ -107,7 +114,6 @@ export function SiteSectionTabs(props: {
107114 />
108115 ) ) }
109116 </ div >
110- { hasMoreSections ? < MoreSectionsButton /> : null }
111117 </ nav >
112118 ) : null ;
113119}
@@ -136,16 +142,3 @@ const Tab = React.forwardRef<HTMLSpanElement, { active: boolean; href: string; l
136142 ) ;
137143 } ,
138144) ;
139-
140- /**
141- * Dropdown trigger for when there are too many sections to show them all
142- */
143- function MoreSectionsButton ( ) {
144- return (
145- < div >
146- < Button variant = "secondary" size = "small" >
147- < Icon icon = "ellipsis-h" size = { 12 } />
148- </ Button >
149- </ div >
150- ) ;
151- }
0 commit comments