@@ -20,6 +20,7 @@ import { seo } from '~/utils/seo'
2020import { capitalize , slugToTitle } from '~/utils/utils'
2121import type { GitHubFileNode } from '~/utils/documents.server'
2222import { z } from 'zod'
23+ import { useWindowSize } from '~/hooks/useWindowSize'
2324
2425const fileQueryOptions = ( repo : string , branch : string , filePath : string ) => {
2526 return queryOptions ( {
@@ -172,7 +173,7 @@ function RouteComponent() {
172173 [ queryClient , library . repo , branch ]
173174 )
174175
175- const [ sidebarWidth , setSidebarWidth ] = React . useState ( 250 )
176+ const [ sidebarWidth , setSidebarWidth ] = React . useState ( 200 )
176177 const [ isResizing , setIsResizing ] = React . useState ( false )
177178 const sidebarRef = React . useRef < HTMLDivElement > ( null )
178179 const startResizeRef = React . useRef ( {
@@ -243,8 +244,16 @@ function RouteComponent() {
243244 const showNetlify = library . showNetlifyUrl
244245
245246 const [ isFullScreen , setIsFullScreen ] = React . useState ( false )
247+ const windowSize = useWindowSize ( )
246248 const [ isSidebarOpen , setIsSidebarOpen ] = React . useState ( true )
247249
250+ React . useEffect ( ( ) => {
251+ // Default to closed on mobile (width < 768px)
252+ if ( windowSize . width && isSidebarOpen ) {
253+ setIsSidebarOpen ( windowSize . width >= 768 )
254+ }
255+ } , [ windowSize . width ] )
256+
248257 // Add escape key handler
249258 React . useEffect ( ( ) => {
250259 const handleEsc = ( e : KeyboardEvent ) => {
@@ -446,7 +455,7 @@ function RouteComponent() {
446455 onMouseDown = { startResize }
447456 />
448457 < div className = "flex-1 overflow-auto relative" >
449- < CodeBlock isEmbedded >
458+ < CodeBlock isEmbedded className = "max-h-[80dvh]" >
450459 < code
451460 className = { `language-${ overrideExtension (
452461 currentPath . split ( '.' ) . pop ( )
@@ -604,7 +613,7 @@ const RenderFileTree = (props: {
604613 : 'hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300'
605614 } `}
606615 >
607- < span className = "flex-shrink-0" >
616+ < span className = "flex-shrink-0 select-none " >
608617 { file . type === 'dir' ? (
609618 < FolderIcon isOpen = { props . expandedFolders . has ( file . path ) } />
610619 ) : (
0 commit comments