1
1
'use client' ;
2
2
import { SiteSection } from '@gitbook/api' ;
3
- import { Icon } from '@gitbook/icons' ;
4
3
import React from 'react' ;
5
4
6
5
import { tcls } from '@/lib/tailwind' ;
7
6
8
- import { Button , Link } from '../primitives' ;
7
+ import { Link } from '../primitives' ;
9
8
10
9
/**
11
10
* A set of navigational tabs representing site sections for multi-section sites
@@ -35,7 +34,11 @@ export function SiteSectionTabs(props: {
35
34
if ( currentTabRef . current && navRef . current ) {
36
35
const rect = currentTabRef . current . getBoundingClientRect ( ) ;
37
36
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
+ } ) ;
39
42
}
40
43
} , [ ] ) ;
41
44
@@ -56,13 +59,11 @@ export function SiteSectionTabs(props: {
56
59
const scale = ( tabDimensions ?. width ?? 0 ) * 0.01 ;
57
60
const startPos = `${ tabDimensions ?. left ?? 0 } px` ;
58
61
59
- const hasMoreSections = false ; /** TODO: determine whether we need to show the more button */
60
-
61
62
return tabs . length > 0 ? (
62
63
< nav
63
64
aria-label = "Sections"
64
65
ref = { navRef }
65
- className = "flex flex-nowrap items-center max-w-screen mb-px"
66
+ className = "flex flex-nowrap items-center mb-px"
66
67
style = {
67
68
{
68
69
'--tab-opacity' : `${ opacity } ` ,
@@ -77,6 +78,12 @@ export function SiteSectionTabs(props: {
77
78
'flex' ,
78
79
'gap-2' ,
79
80
'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
+
80
87
/* add a pseudo element for active tab indicator */
81
88
'after:block' ,
82
89
"after:content-['']" ,
@@ -107,7 +114,6 @@ export function SiteSectionTabs(props: {
107
114
/>
108
115
) ) }
109
116
</ div >
110
- { hasMoreSections ? < MoreSectionsButton /> : null }
111
117
</ nav >
112
118
) : null ;
113
119
}
@@ -136,16 +142,3 @@ const Tab = React.forwardRef<HTMLSpanElement, { active: boolean; href: string; l
136
142
) ;
137
143
} ,
138
144
) ;
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