@@ -20,7 +20,6 @@ import { SpacesDropdown } from './SpacesDropdown';
2020export function Header ( props : { context : GitBookSiteContext ; withTopHeader ?: boolean } ) {
2121 const { context, withTopHeader } = props ;
2222 const { siteSpace, siteSpaces, sections, customization } = context ;
23- const isMultiVariants = siteSpaces . length > 1 ;
2423
2524 return (
2625 < header
@@ -31,7 +30,7 @@ export function Header(props: { context: GitBookSiteContext; withTopHeader?: boo
3130 `h-[${ HEADER_HEIGHT_DESKTOP } px]` ,
3231 'sticky' ,
3332 'top-0' ,
34- 'z-10 ' ,
33+ 'z-30 ' ,
3534 'w-full' ,
3635 'flex-none' ,
3736 'shadow-[0px_1px_0px]' ,
@@ -68,14 +67,12 @@ export function Header(props: { context: GitBookSiteContext; withTopHeader?: boo
6867 'py-3' ,
6968 'min-h-16' ,
7069 'sm:h-16' ,
71- isMultiVariants && 'page-no-toc:max-[400px]:flex-wrap' ,
7270 CONTAINER_STYLE
7371 ) }
7472 >
7573 < div
7674 className = { tcls (
7775 'flex max-w-full' ,
78- isMultiVariants && 'page-no-toc:max-[400px]:w-full' ,
7976 'min-w-0 shrink items-center justify-start gap-2 lg:gap-4'
8077 ) }
8178 >
@@ -86,25 +83,13 @@ export function Header(props: { context: GitBookSiteContext; withTopHeader?: boo
8683 'text-tint-strong' ,
8784 'theme-bold:text-header-link' ,
8885 'hover:bg-tint-hover' ,
89- 'theme-bold:hover:bg-header-link/3'
86+ 'theme-bold:hover:bg-header-link/3' ,
87+ 'page-no-toc:hidden'
9088 ) }
9189 />
9290 < HeaderLogo context = { context } />
9391 </ div >
9492
95- { isMultiVariants && (
96- < div className = "mr-auto page-no-toc:flex hidden" >
97- < SpacesDropdown
98- context = { context }
99- siteSpace = { siteSpace }
100- siteSpaces = { siteSpaces }
101- className = {
102- 'theme-bold:bg-header-link/2 theme-bold:text-header-link theme-bold:ring-header-link/4 theme-bold:group-focus-within/dropdown:bg-header-link/3 theme-bold:group-focus-within/dropdown:text-header-link theme-bold:group-focus-within/dropdown:ring-header-link/6 theme-bold:group-hover/dropdown:bg-header-link/3 theme-bold:group-hover/dropdown:text-header-link theme-bold:group-hover/dropdown:ring-header-link/6 theme-bold:contrast-more:bg-header-background theme-bold:contrast-more:text-header-link theme-bold:contrast-more:ring-header-link theme-bold:contrast-more:group-hover/dropdown:text-header-link theme-bold:contrast-more:group-hover/dropdown:ring-header-link theme-bold:contrast-more:group-focus-within/dropdown:text-header-link theme-bold:contrast-more:group-focus-within/dropdown:ring-header-link theme-bold:dark:bg-header-link/2 theme-bold:dark:text-header-link theme-bold:dark:ring-header-link/4 theme-bold:dark:group-hover/dropdown:bg-header-link/3 theme-bold:dark:group-hover/dropdown:text-header-link theme-bold:dark:group-hover/dropdown:ring-header-link/6 theme-bold:contrast-more:dark:group-hover/dropdown:text-header-link theme-bold:contrast-more:dark:group-hover/dropdown:ring-header-link theme-bold:dark:group-focus-within/dropdown:bg-header-link/3 theme-bold:dark:group-focus-within/dropdown:text-header-link theme-bold:dark:group-focus-within/dropdown:ring-header-link/6 theme-bold:contrast-more:dark:group-focus-within/dropdown:text-header-link theme-bold:contrast-more:dark:group-focus-within/dropdown:ring-header-link'
103- }
104- />
105- </ div >
106- ) }
107-
10893 { customization . header . links . length > 0 && (
10994 < HeaderLinks >
11095 { customization . header . links . map ( ( link , index ) => {
@@ -169,8 +154,48 @@ export function Header(props: { context: GitBookSiteContext; withTopHeader?: boo
169154 </ div >
170155 </ div >
171156 </ div >
172- { sections ? (
173- < SiteSectionTabs sections = { encodeClientSiteSections ( context , sections ) } />
157+
158+ { sections || siteSpaces . length > 1 ? (
159+ < div
160+ className = { tcls (
161+ 'w-full' ,
162+ 'overflow-x-scroll' ,
163+ 'overflow-y-hidden' ,
164+ 'hide-scroll' ,
165+ '-mb-4 pb-4' , // Positive padding / negative margin allows the navigation menu indicator to show in a scroll viewƒ
166+ ! sections ? [ 'hidden' , 'page-no-toc:flex' ] : 'flex'
167+ ) }
168+ >
169+ < div
170+ className = { tcls (
171+ CONTAINER_STYLE ,
172+ 'page-default-width:max-w-[unset]' ,
173+ 'grow' ,
174+ 'flex' ,
175+ 'items-end' ,
176+ 'page-default-width:2xl:px-[calc((100%-1536px+4rem)/2)]'
177+ ) }
178+ >
179+ { siteSpaces . length > 1 && (
180+ < div
181+ id = "variants"
182+ className = "my-2 mr-5 page-no-toc:flex hidden grow border-tint border-r pr-5 *:grow only:mr-0 only:border-none only:pr-0 sm:max-w-64"
183+ >
184+ < SpacesDropdown
185+ context = { context }
186+ siteSpace = { siteSpace }
187+ siteSpaces = { siteSpaces }
188+ className = "w-full grow py-1"
189+ />
190+ </ div >
191+ ) }
192+ { sections && (
193+ < SiteSectionTabs
194+ sections = { encodeClientSiteSections ( context , sections ) }
195+ />
196+ ) }
197+ </ div >
198+ </ div >
174199 ) : null }
175200 </ header >
176201 ) ;
0 commit comments