@@ -179,7 +179,9 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
179179 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"
180180 style = { { boxShadow : '0 1px 4px rgba(0,0,0,0.08)' } }
181181 aria-label = "Scroll left"
182- onClick = { ( ) => { scrollNavBy ( - 120 ) ; } }
182+ onClick = { ( ) => {
183+ scrollNavBy ( - 120 ) ;
184+ } }
183185 >
184186 < svg
185187 className = "transition-transform duration-150 rotate-90 text-black dark:text-white"
@@ -204,7 +206,9 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
204206 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"
205207 style = { { boxShadow : '0 1px 4px rgba(0,0,0,0.08)' } }
206208 aria-label = "Scroll right"
207- onClick = { ( ) => { scrollNavBy ( 120 ) ; } }
209+ onClick = { ( ) => {
210+ scrollNavBy ( 120 ) ;
211+ } }
208212 >
209213 < svg
210214 className = "transition-transform duration-150 -rotate-90 text-black dark:text-white"
@@ -231,15 +235,17 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
231235 >
232236 < ul
233237 className = "flex gap-4 w-full items-center overflow-x-visible"
234- style = { { scrollbarWidth : 'none' } } >
238+ style = { { scrollbarWidth : 'none' } }
239+ >
235240 { mainSections . map ( section => (
236241 < li key = { section . href } className = "list-none relative" >
237242 { section . label === 'Products' ? (
238243 < div style = { { display : 'inline-block' } } >
239244 < button
240245 ref = { productsBtnRef }
241246 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 ) )
243249 ? 'border-b-2 border-[var(--accent-purple)]'
244250 : 'hover:text-[var(--accent)]'
245251 } `}
@@ -311,7 +317,10 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
311317 < button
312318 ref = { conceptsBtnRef }
313319 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 ) )
315324 ? 'border-b-2 border-[var(--accent-purple)]'
316325 : 'hover:text-[var(--accent)]'
317326 } `}
@@ -347,7 +356,10 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
347356 < button
348357 ref = { adminBtnRef }
349358 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 ) )
351363 ? 'border-b-2 border-[var(--accent-purple)]'
352364 : 'hover:text-[var(--accent)]'
353365 } `}
@@ -396,50 +408,60 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
396408 </ div >
397409 </ div >
398410 { /* 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 > { `
407428 .dark .product-dropdown-link {
408429 color: #fff !important;
409430 }
410431 ` } </ 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 > { `
443465 .dark .${ platformSelectorStyles . popover } {
444466 background: #000 !important;
445467 color: #fff !important;
@@ -520,63 +542,85 @@ export default function TopNavClient({platforms}: {platforms: Platform[]}) {
520542 align-items: center;
521543 }
522544 ` } </ 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 > { `
535566 .dark .concepts-dropdown-link {
536567 color: #fff !important;
537568 }
538569 ` } </ 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 > { `
559601 .dark .admin-dropdown-link {
560602 color: #fff !important;
561603 }
562604 ` } </ 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+ ) }
575619 < style > { `
576620 .scrollbar-hide::-webkit-scrollbar {
577621 display: none;
578622 }
579623 ` } </ style >
580624 </ div >
581625 ) ;
582- }
626+ }
0 commit comments