1
- import { component$ , useComputed$ , useSignal , useStyles$ } from '@builder.io/qwik' ;
1
+ import { $ , component$ , useComputed$ , useSignal , useStyles$ } from '@builder.io/qwik' ;
2
2
// eslint-disable-next-line @nx/enforce-module-boundaries
3
3
import { version as headlessVersion } from '../../../../../packages/kit-headless/package.json' ;
4
4
// eslint-disable-next-line @nx/enforce-module-boundaries
@@ -23,6 +23,7 @@ import { LuX } from '@qwikest/icons/lucide';
23
23
import { DocsNavigation } from '../navigation-docs/navigation-docs' ;
24
24
import { useKitMenuItems } from '~/routes/layout' ;
25
25
import { cn } from '@qwik-ui/utils' ;
26
+ import { DiscordIcon } from '../icons/discord' ;
26
27
27
28
export interface HeaderProps {
28
29
showVersion ?: boolean ;
@@ -128,21 +129,34 @@ export default component$(({ showVersion = false }: HeaderProps) => {
128
129
129
130
const { theme, setTheme } = useTheme ( ) ;
130
131
132
+ const switchLightDark = $ ( ( input : string | string [ ] ) : string | string [ ] | undefined => {
133
+ const switchWord = ( word : string ) : string =>
134
+ word . includes ( 'light' )
135
+ ? word . replace ( 'light' , 'dark' )
136
+ : word . replace ( 'dark' , 'light' ) ;
137
+ if ( typeof input === 'string' ) {
138
+ return switchWord ( input ) ;
139
+ } else if ( Array . isArray ( input ) ) {
140
+ return input . map ( ( item ) => switchWord ( item ) ) ;
141
+ }
142
+ } ) ;
143
+
131
144
return (
132
145
< div
133
146
class = { cn (
134
147
'bg-background sticky top-0 z-10 flex h-16 justify-center border-b' ,
135
148
theme ?. includes ( 'brutalist' ) && 'border-b-2' ,
136
149
) }
137
150
>
138
- < header class = "xs:gap-8 flex w-full max-w-screen-2xl items-center gap-6" >
139
- < section class = "mr-auto flex flex-col gap-1 md:flex-row md:gap-8" >
140
- < a href = "/" aria-label = "Qwik UI Logo" class = "lg:ml-8" >
151
+ < header class = "flex w-full max-w-screen-2xl items-center justify-between" >
152
+ < div class = "block sm:hidden" />
153
+ < section class = "xs:flex xs:items-center mr-auto hidden" >
154
+ < a href = "/" aria-label = "Qwik UI Logo" class = "ml-8" >
141
155
< LogoWithBorders />
142
156
</ a >
143
157
{ showVersion && (
144
158
< div data-tip = "Qwik-UI Version" class = "mr-auto" >
145
- < div class = "ml-2 flex flex-row gap-1 text-xs md:mt-1 md: flex-col md:text-sm " >
159
+ < div class = "ml-4 hidden text-xs sm: flex-col md:flex " >
146
160
< span > { kitSignal . value ?. name } Kit </ span >
147
161
< span >
148
162
{ ' ' }
@@ -153,84 +167,81 @@ export default component$(({ showVersion = false }: HeaderProps) => {
153
167
) }
154
168
</ section >
155
169
156
- < nav class = "hidden gap-4 lg:flex" >
157
- < a class = { isRouteActive ( '/about' ) } href = "/about" >
158
- About
159
- </ a >
160
- < a class = { isDocsActive ( '/docs/headless/' ) } href = "/docs/headless/introduction" >
161
- Headless Kit
162
- </ a >
163
- { rootStore . featureFlags ?. showStyled && (
164
- < a class = { isDocsActive ( '/docs/styled/' ) } href = "/docs/styled/introduction" >
165
- Styled Kit
170
+ < div class = "xs:space-x-8 mr-4 flex items-center space-x-6" >
171
+ < nav class = "hidden gap-4 lg:flex" >
172
+ < a class = { isDocsActive ( '/docs/headless/' ) } href = "/docs/headless/introduction" >
173
+ Headless Kit
166
174
</ a >
167
- ) }
175
+ { rootStore . featureFlags ?. showStyled && (
176
+ < a class = { isDocsActive ( '/docs/styled/' ) } href = "/docs/styled/introduction" >
177
+ Styled Kit
178
+ </ a >
179
+ ) }
180
+ </ nav >
181
+ < MakeItYours />
168
182
< a
169
183
class = { isRouteActive ( 'https://discord.gg/PVWUUejrez' ) }
170
184
href = "https://discord.gg/PVWUUejrez"
171
185
target = "_blank"
172
186
>
173
- Community
187
+ < DiscordIcon />
174
188
</ a >
175
- { /* <a href="/contact">Contact</a> */ }
176
- </ nav >
177
- < MakeItYours />
178
- < button
179
- type = "button"
180
- aria-label = "Toggle dark mode"
181
- onClick$ = { ( ) => {
182
- theme ?. includes ( 'light' ) ? setTheme ( 'dark' ) : setTheme ( 'light' ) ;
183
- } }
184
- >
185
- < div class = "hidden dark:block" >
186
- < MoonIcon />
187
- </ div >
188
- < div class = "block dark:hidden" >
189
- < SunIcon />
190
- </ div >
191
- </ button >
192
- < a
193
- target = "_blank"
194
- href = "https://github.com/qwikifiers/qwik-ui"
195
- aria-label = "Qwik-UI GitHub repository"
196
- class = "sm:mr-8"
197
- >
198
- < GitHubIcon />
199
- </ a >
200
- < button
201
- type = "button"
202
- aria-label = "Toggle navigation"
203
- onClick$ = { ( ) => {
204
- isSidebarOpenedSig . value = ! isSidebarOpenedSig . value ;
205
- } }
206
- class = "mr-4 block lg:hidden"
207
- >
208
- { isSidebarOpenedSig . value ? < CloseIcon /> : < MenuIcon /> }
209
- </ button >
210
- < Modal
211
- bind :show = { isSidebarOpenedSig }
212
- class = "sidebar-mobile bg-background text-foreground rounded-base ml-0 mr-auto h-screen max-w-lg border-0 p-8 shadow-md"
213
- >
214
- < ModalHeader >
215
- < h2 class = "text-lg font-bold" > Copy config</ h2 >
216
- < p >
217
- Copy and paste the following code into your global.css file to apply the
218
- styles.
219
- </ p >
220
- </ ModalHeader >
221
- < ModalContent class = "mb-2 pb-4 pt-2" >
222
- < DocsNavigation
223
- linksGroups = { menuItemsGroups }
224
- class = "bg-background max-w-80 overflow-auto"
225
- />
226
- </ ModalContent >
189
+ < a
190
+ target = "_blank"
191
+ href = "https://github.com/qwikifiers/qwik-ui"
192
+ aria-label = "Qwik-UI GitHub repository"
193
+ class = "sm:mr-8"
194
+ >
195
+ < GitHubIcon />
196
+ </ a >
197
+ < button
198
+ type = "button"
199
+ aria-label = "Toggle dark mode"
200
+ onClick$ = { async ( ) => setTheme ( await switchLightDark ( theme || 'light' ) ) }
201
+ >
202
+ < div class = "hidden dark:block" >
203
+ < MoonIcon />
204
+ </ div >
205
+ < div class = "block dark:hidden" >
206
+ < SunIcon />
207
+ </ div >
208
+ </ button >
209
+
227
210
< button
228
- onClick$ = { ( ) => ( isSidebarOpenedSig . value = false ) }
229
- class = "absolute right-6 top-[26px]"
211
+ type = "button"
212
+ aria-label = "Toggle navigation"
213
+ onClick$ = { ( ) => {
214
+ isSidebarOpenedSig . value = ! isSidebarOpenedSig . value ;
215
+ } }
216
+ class = "mr-4 block lg:hidden"
230
217
>
231
- < LuX class = "h-8 w-8" />
218
+ { isSidebarOpenedSig . value ? < CloseIcon /> : < MenuIcon /> }
232
219
</ button >
233
- </ Modal >
220
+ < Modal
221
+ bind :show = { isSidebarOpenedSig }
222
+ class = "sidebar-mobile bg-background text-foreground rounded-base ml-0 mr-auto h-screen max-w-lg border-0 p-8 shadow-md"
223
+ >
224
+ < ModalHeader >
225
+ < h2 class = "text-lg font-bold" > Copy config</ h2 >
226
+ < p >
227
+ Copy and paste the following code into your global.css file to apply the
228
+ styles.
229
+ </ p >
230
+ </ ModalHeader >
231
+ < ModalContent class = "mb-2 pb-4 pt-2" >
232
+ < DocsNavigation
233
+ linksGroups = { menuItemsGroups }
234
+ class = "bg-background max-w-80 overflow-auto"
235
+ />
236
+ </ ModalContent >
237
+ < button
238
+ onClick$ = { ( ) => ( isSidebarOpenedSig . value = false ) }
239
+ class = "absolute right-6 top-[26px]"
240
+ >
241
+ < LuX class = "h-8 w-8" />
242
+ </ button >
243
+ </ Modal >
244
+ </ div >
234
245
</ header >
235
246
</ div >
236
247
) ;
0 commit comments