@@ -179,7 +179,9 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
179
179
className = "absolute left-0 top-1/2 -translate-y-1/2 z-50 pointer-events-auto bg-white/80 hover:bg-white dark:bg-black/80 dark:hover:bg-black rounded-full p-1 shadow"
180
180
style = { { boxShadow : '0 1px 4px rgba(0,0,0,0.08)' } }
181
181
aria-label = "Scroll left"
182
- onClick = { ( ) => { scrollNavBy ( - 120 ) ; } }
182
+ onClick = { ( ) => {
183
+ scrollNavBy ( - 120 ) ;
184
+ } }
183
185
>
184
186
< svg
185
187
className = "transition-transform duration-150 rotate-90 text-black dark:text-white"
@@ -204,7 +206,9 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
204
206
className = "absolute right-0 top-1/2 -translate-y-1/2 z-50 pointer-events-auto bg-white/80 hover:bg-white dark:bg-black/80 dark:hover:bg-black rounded-full p-1 shadow"
205
207
style = { { boxShadow : '0 1px 4px rgba(0,0,0,0.08)' } }
206
208
aria-label = "Scroll right"
207
- onClick = { ( ) => { scrollNavBy ( 120 ) ; } }
209
+ onClick = { ( ) => {
210
+ scrollNavBy ( 120 ) ;
211
+ } }
208
212
>
209
213
< svg
210
214
className = "transition-transform duration-150 -rotate-90 text-black dark:text-white"
@@ -231,15 +235,17 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
231
235
>
232
236
< ul
233
237
className = "flex gap-4 w-full items-center overflow-x-visible"
234
- style = { { scrollbarWidth : 'none' } } >
238
+ style = { { scrollbarWidth : 'none' } }
239
+ >
235
240
{ mainSections . map ( section => (
236
241
< li key = { section . href } className = "list-none relative" >
237
242
{ section . label === 'Products' ? (
238
243
< div style = { { display : 'inline-block' } } >
239
244
< button
240
245
ref = { productsBtnRef }
241
246
className = { `text-[var(--gray-12)] transition-colors duration-150 inline-block py-2 px-1 rounded-t-md flex items-center gap-1 text-[0.875rem] font-normal ${
242
- productsDropdownOpen || productSections . some ( p => pathname ?. startsWith ( p . href ) )
247
+ productsDropdownOpen ||
248
+ productSections . some ( p => pathname ?. startsWith ( p . href ) )
243
249
? 'border-b-2 border-[var(--accent-purple)]'
244
250
: 'hover:text-[var(--accent)]'
245
251
} `}
@@ -311,7 +317,10 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
311
317
< button
312
318
ref = { conceptsBtnRef }
313
319
className = { `text-[var(--gray-12)] transition-colors duration-150 inline-block py-2 px-1 rounded-t-md flex items-center gap-1 text-[0.875rem] font-normal ${
314
- ( conceptsDropdownOpen || ( mainSections . find ( s => s . label === 'Concepts & Reference' ) ?. dropdown ?. some ( d => pathname ?. startsWith ( d . href ) ) ) )
320
+ conceptsDropdownOpen ||
321
+ mainSections
322
+ . find ( s => s . label === 'Concepts & Reference' )
323
+ ?. dropdown ?. some ( d => pathname ?. startsWith ( d . href ) )
315
324
? 'border-b-2 border-[var(--accent-purple)]'
316
325
: 'hover:text-[var(--accent)]'
317
326
} `}
@@ -347,7 +356,10 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
347
356
< button
348
357
ref = { adminBtnRef }
349
358
className = { `text-[var(--gray-12)] transition-colors duration-150 inline-block py-2 px-1 rounded-t-md flex items-center gap-1 text-[0.875rem] font-normal ${
350
- ( adminDropdownOpen || ( mainSections . find ( s => s . label === 'Admin' ) ?. dropdown ?. some ( d => pathname ?. startsWith ( d . href ) ) ) )
359
+ adminDropdownOpen ||
360
+ mainSections
361
+ . find ( s => s . label === 'Admin' )
362
+ ?. dropdown ?. some ( d => pathname ?. startsWith ( d . href ) )
351
363
? 'border-b-2 border-[var(--accent-purple)]'
352
364
: 'hover:text-[var(--accent)]'
353
365
} `}
@@ -396,50 +408,60 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
396
408
</ div >
397
409
</ div >
398
410
{ /* Portal-based dropdowns */ }
399
- { productsDropdownOpen && ReactDOM . createPortal (
400
- < div
401
- ref = { productsDropdownRef }
402
- className = "absolute left-0 bg-white dark:bg-black border border-[var(--gray-a3)] dark:border-[var(--gray-7)] shadow-lg z-50 min-w-[220px] p-2 rounded-b-md rounded-t-none"
403
- style = { { position : 'absolute' , top : productsPosition . top , left : productsPosition . left , minWidth : productsPosition . width , overflowY : 'auto' , scrollbarWidth : 'none' , msOverflowStyle : 'none' } }
404
- onClick = { e => e . stopPropagation ( ) }
405
- >
406
- < style > { `
411
+ { productsDropdownOpen &&
412
+ ReactDOM . createPortal (
413
+ < div
414
+ ref = { productsDropdownRef }
415
+ className = "absolute left-0 bg-white dark:bg-black border border-[var(--gray-a3)] dark:border-[var(--gray-7)] shadow-lg z-50 min-w-[220px] p-2 rounded-b-md rounded-t-none"
416
+ style = { {
417
+ position : 'absolute' ,
418
+ top : productsPosition . top ,
419
+ left : productsPosition . left ,
420
+ minWidth : productsPosition . width ,
421
+ overflowY : 'auto' ,
422
+ scrollbarWidth : 'none' ,
423
+ msOverflowStyle : 'none' ,
424
+ } }
425
+ onClick = { e => e . stopPropagation ( ) }
426
+ >
427
+ < style > { `
407
428
.dark .product-dropdown-link {
408
429
color: #fff !important;
409
430
}
410
431
` } </ style >
411
- { productSections . map ( product => (
412
- < Link
413
- key = { product . href }
414
- href = { product . href }
415
- className = "product-dropdown-link block px-4 py-2 text-[var(--gray-12)] dark:text-white hover:bg-[var(--gray-3)] dark:hover:bg-[var(--gray-8)] rounded text-[0.875rem] font-normal font-sans no-underline"
416
- >
417
- { product . label }
418
- </ Link >
419
- ) ) }
420
- </ div > ,
421
- document . body
422
- ) }
423
- { platformDropdownOpen && ReactDOM . createPortal (
424
- < div
425
- ref = { platformDropdownRef }
426
- className = "absolute left-0 bg-white dark:bg-black shadow-lg z-50 min-w-[300px] p-4 rounded-b-md rounded-t-none border border-[var(--gray-a3)] dark:border-[var(--gray-7)]"
427
- tabIndex = { 0 }
428
- style = { {
429
- position : 'absolute' ,
430
- top : sdksPosition . top ,
431
- left : sdksPosition . left ,
432
- minWidth : 340 ,
433
- width : 340 ,
434
- maxHeight : 'calc(100vh - 32px)' ,
435
- overflowY : 'auto' ,
436
- scrollbarWidth : 'none' ,
437
- msOverflowStyle : 'none' ,
438
- fontFamily : 'var(--font-sans, sans-serif)' ,
439
- } }
440
- onClick = { e => e . stopPropagation ( ) }
441
- >
442
- < style > { `
432
+ { productSections . map ( product => (
433
+ < Link
434
+ key = { product . href }
435
+ href = { product . href }
436
+ className = "product-dropdown-link block px-4 py-2 text-[var(--gray-12)] dark:text-white hover:bg-[var(--gray-3)] dark:hover:bg-[var(--gray-8)] rounded text-[0.875rem] font-normal font-sans no-underline"
437
+ >
438
+ { product . label }
439
+ </ Link >
440
+ ) ) }
441
+ </ div > ,
442
+ document . body
443
+ ) }
444
+ { platformDropdownOpen &&
445
+ ReactDOM . createPortal (
446
+ < div
447
+ ref = { platformDropdownRef }
448
+ className = "absolute left-0 bg-white dark:bg-black shadow-lg z-50 min-w-[300px] p-4 rounded-b-md rounded-t-none border border-[var(--gray-a3)] dark:border-[var(--gray-7)]"
449
+ tabIndex = { 0 }
450
+ style = { {
451
+ position : 'absolute' ,
452
+ top : sdksPosition . top ,
453
+ left : sdksPosition . left ,
454
+ minWidth : 340 ,
455
+ width : 340 ,
456
+ maxHeight : 'calc(100vh - 32px)' ,
457
+ overflowY : 'auto' ,
458
+ scrollbarWidth : 'none' ,
459
+ msOverflowStyle : 'none' ,
460
+ fontFamily : 'var(--font-sans, sans-serif)' ,
461
+ } }
462
+ onClick = { e => e . stopPropagation ( ) }
463
+ >
464
+ < style > { `
443
465
.dark .${ platformSelectorStyles . popover } {
444
466
background: #000 !important;
445
467
color: #fff !important;
@@ -520,63 +542,85 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
520
542
align-items: center;
521
543
}
522
544
` } </ style >
523
- < PlatformSelector platforms = { platforms } listOnly />
524
- </ div > ,
525
- document . body
526
- ) }
527
- { conceptsDropdownOpen && ReactDOM . createPortal (
528
- < div
529
- ref = { conceptsDropdownRef }
530
- className = "absolute left-0 bg-white dark:bg-black border border-[var(--gray-a3)] dark:border-[var(--gray-7)] shadow-lg z-50 min-w-[220px] p-2 rounded-b-md rounded-t-none"
531
- style = { { position : 'absolute' , top : conceptsPosition . top , left : conceptsPosition . left , minWidth : conceptsPosition . width , overflowY : 'auto' , scrollbarWidth : 'none' , msOverflowStyle : 'none' } }
532
- onClick = { e => e . stopPropagation ( ) }
533
- >
534
- < style > { `
545
+ < PlatformSelector platforms = { platforms } listOnly />
546
+ </ div > ,
547
+ document . body
548
+ ) }
549
+ { conceptsDropdownOpen &&
550
+ ReactDOM . createPortal (
551
+ < div
552
+ ref = { conceptsDropdownRef }
553
+ className = "absolute left-0 bg-white dark:bg-black border border-[var(--gray-a3)] dark:border-[var(--gray-7)] shadow-lg z-50 min-w-[220px] p-2 rounded-b-md rounded-t-none"
554
+ style = { {
555
+ position : 'absolute' ,
556
+ top : conceptsPosition . top ,
557
+ left : conceptsPosition . left ,
558
+ minWidth : conceptsPosition . width ,
559
+ overflowY : 'auto' ,
560
+ scrollbarWidth : 'none' ,
561
+ msOverflowStyle : 'none' ,
562
+ } }
563
+ onClick = { e => e . stopPropagation ( ) }
564
+ >
565
+ < style > { `
535
566
.dark .concepts-dropdown-link {
536
567
color: #fff !important;
537
568
}
538
569
` } </ style >
539
- { mainSections . find ( s => s . label === 'Concepts & Reference' ) ?. dropdown ?. map ( dropdown => (
540
- < Link
541
- key = { dropdown . href }
542
- href = { dropdown . href }
543
- className = "concepts-dropdown-link block px-4 py-2 text-[var(--gray-12)] dark:text-white hover:bg-[var(--gray-3)] dark:hover:bg-[var(--gray-8)] rounded text-[0.875rem] font-normal font-sans no-underline"
544
- >
545
- { dropdown . label }
546
- </ Link >
547
- ) ) }
548
- </ div > ,
549
- document . body
550
- ) }
551
- { adminDropdownOpen && ReactDOM . createPortal (
552
- < div
553
- ref = { adminDropdownRef }
554
- className = "absolute left-0 bg-white dark:bg-black border border-[var(--gray-a3)] dark:border-[var(--gray-7)] shadow-lg z-50 min-w-[220px] p-2 rounded-b-md rounded-t-none"
555
- style = { { position : 'absolute' , top : adminPosition . top , left : adminPosition . left , minWidth : adminPosition . width , overflowY : 'auto' , scrollbarWidth : 'none' , msOverflowStyle : 'none' } }
556
- onClick = { e => e . stopPropagation ( ) }
557
- >
558
- < style > { `
570
+ { mainSections
571
+ . find ( s => s . label === 'Concepts & Reference' )
572
+ ?. dropdown ?. map ( dropdown => (
573
+ < Link
574
+ key = { dropdown . href }
575
+ href = { dropdown . href }
576
+ className = "concepts-dropdown-link block px-4 py-2 text-[var(--gray-12)] dark:text-white hover:bg-[var(--gray-3)] dark:hover:bg-[var(--gray-8)] rounded text-[0.875rem] font-normal font-sans no-underline"
577
+ >
578
+ { dropdown . label }
579
+ </ Link >
580
+ ) ) }
581
+ </ div > ,
582
+ document . body
583
+ ) }
584
+ { adminDropdownOpen &&
585
+ ReactDOM . createPortal (
586
+ < div
587
+ ref = { adminDropdownRef }
588
+ className = "absolute left-0 bg-white dark:bg-black border border-[var(--gray-a3)] dark:border-[var(--gray-7)] shadow-lg z-50 min-w-[220px] p-2 rounded-b-md rounded-t-none"
589
+ style = { {
590
+ position : 'absolute' ,
591
+ top : adminPosition . top ,
592
+ left : adminPosition . left ,
593
+ minWidth : adminPosition . width ,
594
+ overflowY : 'auto' ,
595
+ scrollbarWidth : 'none' ,
596
+ msOverflowStyle : 'none' ,
597
+ } }
598
+ onClick = { e => e . stopPropagation ( ) }
599
+ >
600
+ < style > { `
559
601
.dark .admin-dropdown-link {
560
602
color: #fff !important;
561
603
}
562
604
` } </ style >
563
- { mainSections . find ( s => s . label === 'Admin' ) ?. dropdown ?. map ( dropdown => (
564
- < Link
565
- key = { dropdown . href }
566
- href = { dropdown . href }
567
- className = "admin-dropdown-link block px-4 py-2 text-[var(--gray-12)] dark:text-white hover:bg-[var(--gray-3)] dark:hover:bg-[var(--gray-8)] rounded text-[0.875rem] font-normal font-sans no-underline"
568
- >
569
- { dropdown . label }
570
- </ Link >
571
- ) ) }
572
- </ div > ,
573
- document . body
574
- ) }
605
+ { mainSections
606
+ . find ( s => s . label === 'Admin' )
607
+ ?. dropdown ?. map ( dropdown => (
608
+ < Link
609
+ key = { dropdown . href }
610
+ href = { dropdown . href }
611
+ className = "admin-dropdown-link block px-4 py-2 text-[var(--gray-12)] dark:text-white hover:bg-[var(--gray-3)] dark:hover:bg-[var(--gray-8)] rounded text-[0.875rem] font-normal font-sans no-underline"
612
+ >
613
+ { dropdown . label }
614
+ </ Link >
615
+ ) ) }
616
+ </ div > ,
617
+ document . body
618
+ ) }
575
619
< style > { `
576
620
.scrollbar-hide::-webkit-scrollbar {
577
621
display: none;
578
622
}
579
623
` } </ style >
580
624
</ div >
581
625
) ;
582
- }
626
+ }
0 commit comments