@@ -15,6 +15,7 @@ import { HeaderLogo } from './HeaderLogo';
15
15
import { SpacesDropdown } from './SpacesDropdown' ;
16
16
import { SearchButton } from '../Search' ;
17
17
import { SiteSectionTabs } from '../SiteSectionTabs' ;
18
+ import { HeaderMobileMenu } from './HeaderMobileMenu' ;
18
19
/**
19
20
* Render the header for the space.
20
21
*/
@@ -45,104 +46,156 @@ export function Header(props: {
45
46
'w-full' ,
46
47
'flex-none' ,
47
48
'shadow-thinbottom' ,
49
+ 'dark:shadow-light/2' ,
50
+ 'bg-light' ,
51
+ 'dark:bg-dark' ,
48
52
withTopHeader ? null : 'lg:hidden' ,
49
- 'lg:z-10' ,
50
- 'dark:shadow-light/1' ,
51
- `${ isCustomizationDefault || ! withTopHeader ? 'bg-light' : 'bg-header-background' } ` ,
52
- `${
53
- isCustomizationDefault || ! withTopHeader
54
- ? 'dark:bg-dark'
55
- : 'bg-header-background'
56
- } `,
53
+ 'text-sm' ,
54
+ 'bg-opacity-9' ,
55
+ 'dark:bg-opacity-9' ,
56
+ 'backdrop-blur-lg' ,
57
+ 'contrast-more:bg-opacity-11' ,
58
+ 'contrast-more:dark:bg-opacity-11' ,
57
59
) }
58
60
>
59
- < div className = { tcls ( 'scroll-nojump' ) } >
60
- < div
61
- className = { tcls (
62
- 'gap-4' ,
63
- 'grid' ,
64
- 'grid-flow-col' ,
65
- 'auto-cols-[auto_auto_1fr_auto]' ,
66
- 'h-16' ,
67
- 'items-center' ,
68
- 'align-center' ,
69
- 'justify-between' ,
70
- 'w-full' ,
71
- CONTAINER_STYLE ,
72
- ) }
73
- >
74
- < HeaderLogo site = { site } space = { space } customization = { customization } />
75
- < div className = "z-20" >
76
- { ! hasSiteSections && isMultiVariants ? (
77
- < SpacesDropdown space = { space } spaces = { spaces } />
78
- ) : null }
79
- </ div >
80
- < HeaderLinks >
81
- { customization . header . links . map ( ( link , index ) => {
82
- return (
83
- < HeaderLink
84
- key = { index }
85
- link = { link }
86
- context = { context }
87
- customization = { customization }
88
- />
89
- ) ;
90
- } ) }
91
- < HeaderLinkMore
92
- label = { t ( getSpaceLanguage ( customization ) , 'more' ) }
93
- links = { customization . header . links }
94
- context = { context }
95
- customization = { customization }
96
- />
97
- </ HeaderLinks >
61
+ < div
62
+ className = { tcls (
63
+ ! isCustomizationDefault &&
64
+ withTopHeader && [
65
+ 'bg-header-background' ,
66
+ 'shadow-thinbottom' ,
67
+ 'dark:shadow-light/2' ,
68
+ ] ,
69
+ ) }
70
+ >
71
+ < div className = { tcls ( 'scroll-nojump' ) } >
98
72
< div
99
73
className = { tcls (
74
+ 'gap-4' ,
75
+ 'lg:gap-8' ,
100
76
'flex' ,
101
- 'md:w-56' ,
102
- 'grow-0' ,
103
- 'shrink-0' ,
104
- 'justify-self-end' ,
77
+ 'h-16' ,
78
+ 'items-center' ,
79
+ 'justify-between' ,
80
+ 'w-full' ,
81
+ CONTAINER_STYLE ,
105
82
) }
106
83
>
107
- < Suspense fallback = { null } >
108
- < SearchButton
109
- style = {
110
- ! isCustomizationDefault && withTopHeader
111
- ? [
112
- 'bg-header-link/3' ,
113
- 'shadow-sm' ,
114
- 'ring-header-link/3' ,
115
- '[&>span]:!text-header-link/7' ,
116
- '[&_svg]:text-header-link' ,
117
- 'contrast-more:bg-transparent' ,
118
- 'contrast-more:ring-header-link' ,
119
- 'contrast-more:[&>span]:!text-header-link' ,
120
- 'dark:bg-header-link/3' ,
121
- 'dark:ring-header-link/3' ,
122
- '[&>span]:!text-header-link/7' ,
123
- 'dark:[&_svg]:text-header-link' ,
124
- 'dark:contrast-more:bg-transparent' ,
125
- 'dark:contrast-more:ring-header-link' ,
126
- 'dark:contrast-more:[&>span]:!text-header-link' ,
127
- ]
128
- : null
129
- }
130
- >
131
- < span className = { tcls ( 'flex-1' ) } >
132
- { t (
133
- getSpaceLanguage ( customization ) ,
134
- customization . aiSearch . enabled ? 'search_or_ask' : 'search' ,
135
- ) }
136
- </ span >
137
- </ SearchButton >
138
- </ Suspense >
84
+ < div className = "flex max-w-full shrink min-w-0 gap-2 lg:gap-4 justify-start items-center" >
85
+ < HeaderMobileMenu
86
+ className = { tcls (
87
+ 'lg:hidden' ,
88
+ '-ml-2' ,
89
+ customization . header . preset ===
90
+ CustomizationHeaderPreset . Default
91
+ ? [ 'text-dark' , 'dark:text-light' ]
92
+ : 'text-header-link' ,
93
+ ) }
94
+ />
95
+ < HeaderLogo site = { site } space = { space } customization = { customization } />
96
+ { ! hasSiteSections && isMultiVariants ? (
97
+ < div className = "z-20 shrink hidden sm:block" >
98
+ < SpacesDropdown space = { space } spaces = { spaces } />
99
+ </ div >
100
+ ) : null }
101
+ </ div >
102
+
103
+ { customization . header . links . length > 0 && (
104
+ < HeaderLinks >
105
+ { customization . header . links . map ( ( link , index ) => {
106
+ return (
107
+ < HeaderLink
108
+ key = { index }
109
+ link = { link }
110
+ context = { context }
111
+ customization = { customization }
112
+ />
113
+ ) ;
114
+ } ) }
115
+ < HeaderLinkMore
116
+ label = { t ( getSpaceLanguage ( customization ) , 'more' ) }
117
+ links = { customization . header . links }
118
+ context = { context }
119
+ customization = { customization }
120
+ />
121
+ </ HeaderLinks >
122
+ ) }
123
+ < div
124
+ className = { tcls (
125
+ 'flex' ,
126
+ 'md:w-56' ,
127
+ 'grow-0' ,
128
+ 'shrink-0' ,
129
+ 'justify-self-end' ,
130
+ ) }
131
+ >
132
+ < Suspense fallback = { null } >
133
+ < SearchButton
134
+ style = {
135
+ ! isCustomizationDefault && withTopHeader
136
+ ? [
137
+ 'bg-header-link/2' ,
138
+ 'dark:bg-header-link/2' ,
139
+ 'hover:bg-header-link/3' ,
140
+ 'dark:hover:bg-header-link/3' ,
141
+
142
+ 'text-header-link/8' ,
143
+ 'dark:text-header-link/8' ,
144
+ 'hover:text-header-link' ,
145
+ 'dark:hover:text-header-link' ,
146
+
147
+ 'ring-header-link/4' ,
148
+ 'dark:ring-header-link/4' ,
149
+ 'hover:ring-header-link/5' ,
150
+ 'dark:hover:ring-header-link/5' ,
151
+
152
+ '[&_svg]:text-header-link/10' ,
153
+ 'dark:[&_svg]:text-header-link/10' ,
154
+ '[&_.shortcut]:text-header-link/8' ,
155
+ 'dark:[&_.shortcut]:text-header-link/8' ,
156
+
157
+ 'contrast-more:bg-header-background' ,
158
+ 'contrast-more:text-header-link' ,
159
+ 'contrast-more:ring-header-link' ,
160
+ 'contrast-more:hover:bg-header-background' ,
161
+ 'contrast-more:hover:ring-header-link' ,
162
+ 'contrast-more:focus:text-header-link' ,
163
+ 'contrast-more:focus:bg-header-background' ,
164
+ 'contrast-more:focus:ring-header-link' ,
165
+ 'dark:contrast-more:bg-header-background' ,
166
+ 'dark:contrast-more:text-header-link' ,
167
+ 'dark:contrast-more:ring-header-link' ,
168
+ 'dark:contrast-more:hover:bg-header-background' ,
169
+ 'dark:contrast-more:hover:ring-header-link' ,
170
+ 'dark:contrast-more:focus:text-header-link' ,
171
+ 'dark:contrast-more:focus:bg-header-background' ,
172
+ 'dark:contrast-more:focus:ring-header-link' ,
173
+
174
+ 'shadow-none' ,
175
+ ]
176
+ : null
177
+ }
178
+ >
179
+ < span className = { tcls ( 'flex-1' ) } >
180
+ { t (
181
+ getSpaceLanguage ( customization ) ,
182
+ customization . aiSearch . enabled
183
+ ? 'search_or_ask'
184
+ : 'search' ,
185
+ ) }
186
+ ...
187
+ </ span >
188
+ </ SearchButton >
189
+ </ Suspense >
190
+ </ div >
139
191
</ div >
140
192
</ div >
141
193
</ div >
142
194
{ sections ? (
143
195
< div
144
196
className = { tcls (
145
- 'w-full shadow-thintop dark:shadow-light/1 bg-light dark:bg-dark mt-0.5' ,
197
+ 'scroll-nojump' ,
198
+ 'w-full' ,
146
199
// Handle long section tabs, particularly on smaller screens.
147
200
'overflow-x-auto hide-scroll' ,
148
201
) }
0 commit comments