🎥 Make videos programmatically with React
`@remotion/studio`: Keep right sidebar open at narrower widths
Jonny Burger1644c48762c3
diff --git a/packages/studio/src/components/SidebarCollapserControls.tsx b/packages/studio/src/components/SidebarCollapserControls.tsxindex 93be53ca90..31dc1b18b2 100644--- a/packages/studio/src/components/SidebarCollapserControls.tsx+++ b/packages/studio/src/components/SidebarCollapserControls.tsx@@ -15,7 +15,7 @@ import {useKeyboardShortcutLabel,} from '../helpers/use-keyboard-shortcut-label';import {- SIDEBAR_RESPONSIVE_BREAKPOINT,+ SIDEBAR_RESPONSIVE_BREAKPOINTS,useResponsiveSidebarStatus,} from '../helpers/use-responsive-sidebar-status';import {SidebarContext} from '../state/sidebar';@@ -47,7 +47,7 @@ export const SidebarCollapserControl: React.FC<{sidebarCollapsedDuringDrag,} = useContext(SidebarContext);const keybindings = useKeybinding();- const isNarrowLayout = useBreakpoint(SIDEBAR_RESPONSIVE_BREAKPOINT);+ const isNarrowLayout = useBreakpoint(SIDEBAR_RESPONSIVE_BREAKPOINTS.right);const leftSidebarStatus = useResponsiveSidebarStatus('left');const rightSidebarStatus = useResponsiveSidebarStatus('right');diff --git a/packages/studio/src/components/Timeline/TimelineSelection.tsx b/packages/studio/src/components/Timeline/TimelineSelection.tsxindex d69d5b871e..2960b1e401 100644--- a/packages/studio/src/components/Timeline/TimelineSelection.tsx+++ b/packages/studio/src/components/Timeline/TimelineSelection.tsx@@ -64,7 +64,7 @@ import {import {timelineNodePathInfoToKey} from '../../helpers/timeline-node-path-key';import {useBreakpoint} from '../../helpers/use-breakpoint';import {useKeybinding} from '../../helpers/use-keybinding';-import {SIDEBAR_RESPONSIVE_BREAKPOINT} from '../../helpers/use-responsive-sidebar-status';+import {SIDEBAR_RESPONSIVE_BREAKPOINTS} from '../../helpers/use-responsive-sidebar-status';import {useSyncExternalStore} from '../../helpers/use-sync-external-store';import {SidebarContext} from '../../state/sidebar';import {useZIndex} from '../../state/z-index';@@ -1090,7 +1090,7 @@ export const TimelineSelectionProvider: React.FC<{const {expandParentTracks} = useContext(ExpandedTracksSetterContext);const {setRightSidebarTemporaryExpansion, sidebarCollapsedStateRight} =useContext(SidebarContext);- const isNarrowLayout = useBreakpoint(SIDEBAR_RESPONSIVE_BREAKPOINT);+ const isNarrowLayout = useBreakpoint(SIDEBAR_RESPONSIVE_BREAKPOINTS.right);const canSelect =isStudioSelectionEnabled() &&(previewServerState.type === 'connected' ||diff --git a/packages/studio/src/components/TopPanel.tsx b/packages/studio/src/components/TopPanel.tsxindex 861661fa28..a9df9d6869 100644--- a/packages/studio/src/components/TopPanel.tsx+++ b/packages/studio/src/components/TopPanel.tsx@@ -2,7 +2,7 @@ import React, {useCallback, useContext, useEffect, useMemo} from 'react';import {Internals} from 'remotion';import {useBreakpoint} from '../helpers/use-breakpoint';import {- SIDEBAR_RESPONSIVE_BREAKPOINT,+ SIDEBAR_RESPONSIVE_BREAKPOINTS,useResponsiveSidebarStatus,} from '../helpers/use-responsive-sidebar-status';import {RULER_WIDTH} from '../state/editor-rulers';@@ -58,7 +58,7 @@ const TopPanelInner: React.FC<{sidebarCollapsedStateRight,} = useContext(SidebarContext);const rulersAreVisible = useIsRulerVisible();- const isNarrowLayout = useBreakpoint(SIDEBAR_RESPONSIVE_BREAKPOINT);+ const isNarrowLayout = useBreakpoint(SIDEBAR_RESPONSIVE_BREAKPOINTS.right);const {canvasContent} = useContext(Internals.CompositionManager);diff --git a/packages/studio/src/helpers/mobile-layout.ts b/packages/studio/src/helpers/mobile-layout.tsindex be71e5079a..f56835bb21 100644--- a/packages/studio/src/helpers/mobile-layout.ts+++ b/packages/studio/src/helpers/mobile-layout.ts@@ -1,6 +1,6 @@import {useEffect, useRef, useState} from 'react';-const breakpoint = 900;+const breakpoint = 800;function getIsMobile() {return window.innerWidth < breakpoint;diff --git a/packages/studio/src/helpers/use-responsive-sidebar-status.ts b/packages/studio/src/helpers/use-responsive-sidebar-status.tsindex 22e85f633b..1d39d9640a 100644--- a/packages/studio/src/helpers/use-responsive-sidebar-status.ts+++ b/packages/studio/src/helpers/use-responsive-sidebar-status.ts@@ -3,7 +3,10 @@ import {SidebarContext} from '../state/sidebar';import {useMobileLayout} from './mobile-layout';import {useBreakpoint} from './use-breakpoint';-export const SIDEBAR_RESPONSIVE_BREAKPOINT = 1200;+export const SIDEBAR_RESPONSIVE_BREAKPOINTS = {+ left: 1000,+ right: 800,+};export const useResponsiveSidebarStatus = (side: 'left' | 'right',@@ -14,7 +17,7 @@ export const useResponsiveSidebarStatus = (sidebarCollapsedStateRight,} = useContext(SidebarContext);const isMobileLayout = useMobileLayout();- const responsiveStatus = useBreakpoint(SIDEBAR_RESPONSIVE_BREAKPOINT)+ const responsiveStatus = useBreakpoint(SIDEBAR_RESPONSIVE_BREAKPOINTS[side])? 'collapsed': 'expanded';const collapsedState =