@@ -2,13 +2,13 @@ import styled from 'styled-components';
22import * as React from 'react' ;
33import { useHover } from '../../helpers/useHover' ;
44import { useSettings } from '../../helpers/AppSettings' ;
5- import { useWindowSize } from '../../helpers/useWindowSize' ;
65import { SideBarDrive } from './SideBarDrive' ;
76import { DragAreaBase , useResizable } from '../../hooks/useResizable' ;
87import { useCombineRefs } from '../../hooks/useCombineRefs' ;
98import { NavBarSpacer } from '../NavBarSpacer' ;
109import { AppMenu } from './AppMenu' ;
1110import { About } from './About' ;
11+ import { useMediaQuery } from '../../hooks/useMediaQuery' ;
1212
1313/** Amount of pixels where the sidebar automatically shows */
1414export const SIDEBAR_TOGGLE_WIDTH = 600 ;
@@ -18,18 +18,15 @@ const SideBarDriveMemo = React.memo(SideBarDrive);
1818export function SideBar ( ) : JSX . Element {
1919 const { drive, sideBarLocked, setSideBarLocked } = useSettings ( ) ;
2020 const [ ref , hoveringOverSideBar ] = useHover < HTMLElement > ( sideBarLocked ) ;
21- const windowSize = useWindowSize ( ) ;
21+ // Check if the window is small enough to hide the sidebar
22+ const isWideScreen = useMediaQuery ( `(min-width: ${ SIDEBAR_TOGGLE_WIDTH } px)` ) ;
2223
2324 const { size, targetRef, dragAreaRef, isDragging } = useResizable (
2425 300 ,
2526 200 ,
2627 2000 ,
2728 ) ;
2829
29- const isWideScreen = windowSize . width
30- ? windowSize . width > SIDEBAR_TOGGLE_WIDTH
31- : false ;
32-
3330 const mountRefs = useCombineRefs ( [ ref , targetRef ] ) ;
3431
3532 /**
0 commit comments