@@ -376,8 +376,10 @@ function RouteComponent() {
376376 } `}
377377 >
378378 Code Explorer
379- { activeTab === 'code' && (
379+ { activeTab === 'code' ? (
380380 < div className = "absolute bottom-0 left-0 right-0 h-0.5 bg-blue-500" />
381+ ) : (
382+ < div className = "absolute bottom-0 left-0 right-0 h-0.5 bg-transparent" />
381383 ) }
382384 </ button >
383385 < button
@@ -389,8 +391,10 @@ function RouteComponent() {
389391 } `}
390392 >
391393 Interactive Sandbox
392- { activeTab === 'sandbox' && (
394+ { activeTab === 'sandbox' ? (
393395 < div className = "absolute bottom-0 left-0 right-0 h-0.5 bg-blue-500" />
396+ ) : (
397+ < div className = "absolute bottom-0 left-0 right-0 h-0.5 bg-transparent" />
394398 ) }
395399 </ button >
396400 </ div >
@@ -425,49 +429,51 @@ function RouteComponent() {
425429 </ div >
426430
427431 < div className = "relative flex-1" >
428- < div className = { `${ activeTab === 'code' ? '' : 'hidden' } ` } >
429- < div className = "flex flex-1" >
430- < div
431- ref = { sidebarRef }
432- style = { { width : isSidebarOpen ? sidebarWidth : 0 } }
433- className = { `flex-shrink-0 overflow-y-auto bg-gradient-to-r from-gray-50 via-gray-50 to-transparent dark:from-gray-800/50 dark:via-gray-800/50 dark:to-transparent pr-2 shadow-sm ${
434- isResizing ? '' : 'transition-all duration-300'
435- } ${ isSidebarOpen ? '' : 'w-0 pr-0' } `}
432+ < div
433+ className = { `absolute inset-0 flex ${
434+ activeTab === 'code' ? '' : 'hidden'
435+ } `}
436+ >
437+ < div
438+ ref = { sidebarRef }
439+ style = { { width : isSidebarOpen ? sidebarWidth : 0 } }
440+ className = { `flex-shrink-0 overflow-y-auto bg-gradient-to-r from-gray-50 via-gray-50 to-transparent dark:from-gray-800/50 dark:via-gray-800/50 dark:to-transparent pr-2 shadow-sm ${
441+ isResizing ? '' : 'transition-all duration-300'
442+ } ${ isSidebarOpen ? '' : 'w-0 pr-0' } `}
443+ >
444+ { gitHubFiles && isSidebarOpen ? (
445+ < div className = "p-2" >
446+ < RenderFileTree
447+ files = { gitHubFiles }
448+ libraryColor = { libraryColor }
449+ toggleFolder = { toggleFolder }
450+ prefetchFileContent = { prefetchFileContent }
451+ expandedFolders = { expandedFolders }
452+ currentPath = { currentPath }
453+ setCurrentPath = { setCurrentPath }
454+ />
455+ </ div >
456+ ) : null }
457+ </ div >
458+ < div
459+ className = { `w-1 cursor-col-resize hover:bg-gray-300 dark:hover:bg-gray-600 active:bg-gray-400 dark:active:bg-gray-500 ${
460+ isResizing ? '' : 'transition-colors'
461+ } ${ isSidebarOpen ? '' : 'hidden' } `}
462+ onMouseDown = { startResize }
463+ />
464+ < div className = "flex-1 overflow-auto relative" >
465+ < CodeBlock
466+ isEmbedded
467+ className = { `max-h-[${ isFullScreen ? '90' : '80' } dvh]` }
436468 >
437- { gitHubFiles && isSidebarOpen ? (
438- < div className = "p-2" >
439- < RenderFileTree
440- files = { gitHubFiles }
441- libraryColor = { libraryColor }
442- toggleFolder = { toggleFolder }
443- prefetchFileContent = { prefetchFileContent }
444- expandedFolders = { expandedFolders }
445- currentPath = { currentPath }
446- setCurrentPath = { setCurrentPath }
447- />
448- </ div >
449- ) : null }
450- </ div >
451- < div
452- className = { `w-1 cursor-col-resize hover:bg-gray-300 dark:hover:bg-gray-600 active:bg-gray-400 dark:active:bg-gray-500 ${
453- isResizing ? '' : 'transition-colors'
454- } ${ isSidebarOpen ? '' : 'hidden' } `}
455- onMouseDown = { startResize }
456- />
457- < div className = "flex-1 overflow-auto relative" >
458- < CodeBlock
459- isEmbedded
460- className = { `max-h-[${ isFullScreen ? '90' : '80' } dvh]` }
469+ < code
470+ className = { `language-${ overrideExtension (
471+ currentPath . split ( '.' ) . pop ( )
472+ ) } `}
461473 >
462- < code
463- className = { `language-${ overrideExtension (
464- currentPath . split ( '.' ) . pop ( )
465- ) } `}
466- >
467- { currentCode }
468- </ code >
469- </ CodeBlock >
470- </ div >
474+ { currentCode }
475+ </ code >
476+ </ CodeBlock >
471477 </ div >
472478 </ div >
473479
@@ -593,9 +599,9 @@ const RenderFileTree = (props: {
593599 if ( ! props . files ) return null
594600
595601 return (
596- < div className = "flex flex-col" >
602+ < ul className = "flex flex-col" >
597603 { props . files . map ( ( file ) => (
598- < div key = { file . path } style = { { marginLeft : getMarginLeft ( file . depth ) } } >
604+ < li key = { file . path } style = { { marginLeft : getMarginLeft ( file . depth ) } } >
599605 < button
600606 onClick = { ( ) => {
601607 if ( file . type === 'dir' ) {
@@ -628,8 +634,8 @@ const RenderFileTree = (props: {
628634 { file . children && props . expandedFolders . has ( file . path ) && (
629635 < RenderFileTree { ...props } files = { file . children } />
630636 ) }
631- </ div >
637+ </ li >
632638 ) ) }
633- </ div >
639+ </ ul >
634640 )
635641}
0 commit comments