🎥 Make videos programmatically with React
`@remotion/studio`: Polish timeline styling (#8262)
Jonny Burger2a2be87d83e3
diff --git a/packages/studio/src/components/SelectedOutlineOverlay.tsx b/packages/studio/src/components/SelectedOutlineOverlay.tsxindex 939786fb0c..6186deb414 100644--- a/packages/studio/src/components/SelectedOutlineOverlay.tsx+++ b/packages/studio/src/components/SelectedOutlineOverlay.tsx@@ -25,8 +25,8 @@ import {ContextMenuForTarget} from './ContextMenu';import {addEffectFromDragData,getEffectDragData,- hasExplicitEffectDragType,hasEffectDragType,+ hasExplicitEffectDragType,} from './effect-drag-and-drop';import {forceSpecificCursor,diff --git a/packages/studio/src/components/Timeline/TimelineExpandedKeyframeRow.tsx b/packages/studio/src/components/Timeline/TimelineExpandedKeyframeRow.tsxindex b733fcda29..89ebe29a72 100644--- a/packages/studio/src/components/Timeline/TimelineExpandedKeyframeRow.tsx+++ b/packages/studio/src/components/Timeline/TimelineExpandedKeyframeRow.tsx@@ -6,8 +6,8 @@ import type {getTimelineKeyframes} from './get-timeline-keyframes';import {TimelineKeyframeDiamond} from './TimelineKeyframeDiamond';import {TimelineKeyframeEasingLine} from './TimelineKeyframeEasingLine';import {- ENABLE_OUTLINES,EASING_SELECTION_ENABLED,+ ENABLE_OUTLINES,getTimelineSelectedTrackHighlightStyle,useTimelineRowSelection,} from './TimelineSelection';diff --git a/packages/studio/src/components/Timeline/TimelineHeightContainer.tsx b/packages/studio/src/components/Timeline/TimelineHeightContainer.tsxindex b629c84d66..1044419f7e 100644--- a/packages/studio/src/components/Timeline/TimelineHeightContainer.tsx+++ b/packages/studio/src/components/Timeline/TimelineHeightContainer.tsx@@ -1,5 +1,6 @@import React, {useMemo} from 'react';import type {TrackWithHash} from '../../helpers/get-timeline-sequence-sort-key';+import {TIMELINE_BACKGROUND} from './TimelineSelection';import {useTimelineHeight} from './use-timeline-height';const baseStyle: React.CSSProperties = {@@ -7,6 +8,7 @@ const baseStyle: React.CSSProperties = {flex: 1,minHeight: '100%',overflowX: 'hidden',+ backgroundColor: TIMELINE_BACKGROUND,};const TimelineHeightContainerInner: React.FC<{diff --git a/packages/studio/src/components/Timeline/TimelineScrollable.tsx b/packages/studio/src/components/Timeline/TimelineScrollable.tsxindex ccd994e3ef..48f135e364 100644--- a/packages/studio/src/components/Timeline/TimelineScrollable.tsx+++ b/packages/studio/src/components/Timeline/TimelineScrollable.tsx@@ -1,7 +1,7 @@import React, {useMemo} from 'react';-import {TIMELINE_BACKGROUND} from '../../helpers/colors';import {HORIZONTAL_SCROLLBAR_CLASSNAME} from '../Menu/is-menu-item';import {scrollableRef} from './timeline-refs';+import {TIMELINE_BACKGROUND} from './TimelineSelection';const outer: React.CSSProperties = {width: '100%',diff --git a/packages/studio/src/components/Timeline/TimelineSelection.tsx b/packages/studio/src/components/Timeline/TimelineSelection.tsxindex 4f51e1e538..f13fedb127 100644--- a/packages/studio/src/components/Timeline/TimelineSelection.tsx+++ b/packages/studio/src/components/Timeline/TimelineSelection.tsx@@ -10,6 +10,7 @@ import React, {type CSSProperties,} from 'react';import {StudioServerConnectionCtx} from '../../helpers/client-id';+import {BACKGROUND} from '../../helpers/colors';import type {SequenceNodePathInfo,TrackWithHash,@@ -63,6 +64,10 @@ export const getTimelineSelectedTrackHighlightStyle = (export const SELECTION_ENABLED = false;export const TIMELINE_TOP_DRAG = false;export const ENABLE_OUTLINES = false;+export const TIMELINE_BACKGROUND = ENABLE_OUTLINES ? '#0F1113' : '#111';+export const TIMELINE_TICKS_BACKGROUND = ENABLE_OUTLINES+ ? BACKGROUND+ : TIMELINE_BACKGROUND;export const EASING_SELECTION_ENABLED = false;type TimelineSelectionBase = {diff --git a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsxindex ce601a6333..00852463b9 100644--- a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx+++ b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx@@ -24,6 +24,7 @@ import {ExpandedTracksGetterContext,ExpandedTracksSetterContext,} from '../ExpandedTracksProvider';+import {Spacing} from '../layout';import type {ComboboxValue} from '../NewComposition/ComboBox';import {showNotification} from '../Notifications/NotificationCenter';import {useSelectAsset} from '../use-select-asset';@@ -57,7 +58,6 @@ const labelContainerStyle: React.CSSProperties = {display: 'flex',flexDirection: 'row',minWidth: 0,- gap: 4,};const effectDropHighlight: React.CSSProperties = {@@ -925,7 +925,12 @@ export const TimelineSequenceItem: React.FC<{selected={selected}containsSelection={containsSelection}/>- {mediaSrc ? <TimelineMediaInfo src={mediaSrc} /> : null}+ {mediaSrc ? (+ <>+ <Spacing x={0.5} /> <TimelineMediaInfo src={mediaSrc} />+ </>+ ) : null}+ <Spacing x={0.5} /><TimelineItemStack originalLocation={originalLocation} /></div></TimelineRowChrome>diff --git a/packages/studio/src/components/Timeline/TimelineSequenceName.tsx b/packages/studio/src/components/Timeline/TimelineSequenceName.tsxindex 6d4ece7c21..c23ce0062f 100644--- a/packages/studio/src/components/Timeline/TimelineSequenceName.tsx+++ b/packages/studio/src/components/Timeline/TimelineSequenceName.tsx@@ -47,7 +47,6 @@ export const TimelineSequenceName: React.FC<{fontSize: 12,whiteSpace: 'nowrap',textOverflow: 'ellipsis',- overflow: 'hidden',color: getTimelineColor(selected, false),userSelect: 'none',WebkitUserSelect: 'none',diff --git a/packages/studio/src/components/Timeline/TimelineTimeIndicators.tsx b/packages/studio/src/components/Timeline/TimelineTimeIndicators.tsxindex 6a0447613e..5970e525f2 100644--- a/packages/studio/src/components/Timeline/TimelineTimeIndicators.tsx+++ b/packages/studio/src/components/Timeline/TimelineTimeIndicators.tsx@@ -3,7 +3,6 @@ import {Internals} from 'remotion';import {BACKGROUND,LIGHT_TEXT,- TIMELINE_BACKGROUND,TIMELINE_TRACK_SEPARATOR,} from '../../helpers/colors';import {@@ -14,6 +13,7 @@ import {renderFrame} from '../../state/render-frame';import {TimeValue} from '../TimeValue';import {timelineVerticalScroll} from './timeline-refs';import {getFrameIncrementFromWidth} from './timeline-scroll-logic';+import {ENABLE_OUTLINES, TIMELINE_TICKS_BACKGROUND} from './TimelineSelection';import {TimelineWidthContext} from './TimelineWidthProvider';export const TIMELINE_TIME_INDICATOR_HEIGHT = 39;@@ -21,8 +21,11 @@ export const TIMELINE_TIME_INDICATOR_HEIGHT = 39;const container: React.CSSProperties = {height: TIMELINE_TIME_INDICATOR_HEIGHT,position: 'absolute',- backgroundColor: TIMELINE_BACKGROUND,+ backgroundColor: TIMELINE_TICKS_BACKGROUND,top: 0,+ borderBottom: ENABLE_OUTLINES+ ? `${TIMELINE_ITEM_BORDER_BOTTOM}px solid ${TIMELINE_TRACK_SEPARATOR}`+ : undefined,};const tick: React.CSSProperties = {@@ -52,7 +55,7 @@ const timeValue: React.CSSProperties = {height: TIMELINE_TIME_INDICATOR_HEIGHT,position: 'absolute',top: 0,- width: '100%',+ width: 'calc(100% + 1.5px)',paddingLeft: 10,display: 'flex',alignItems: 'center',diff --git a/packages/studio/src/helpers/colors.ts b/packages/studio/src/helpers/colors.tsindex 4cfb533af6..fdfa1e9f41 100644--- a/packages/studio/src/helpers/colors.ts+++ b/packages/studio/src/helpers/colors.ts@@ -11,7 +11,6 @@ const SELECTED_HOVER_BACKGROUND = 'hsla(0, 0%, 100%, 0.25)';export const CLEAR_HOVER = 'rgba(255, 255, 255, 0.06)';export const INPUT_BORDER_COLOR_UNHOVERED = 'rgba(0, 0, 0, 0.6)';export const INPUT_BORDER_COLOR_HOVERED = 'rgba(255, 255, 255, 0.05)';-export const TIMELINE_BACKGROUND = '#111';export const FAIL_COLOR = '#ff3232';export const TEXT_COLOR = '#fff';export const WARNING_COLOR = '#f1c40f';diff --git a/packages/studio/src/test/timeline-selection.test.ts b/packages/studio/src/test/timeline-selection.test.tsindex b92242a7c3..273adeb187 100644--- a/packages/studio/src/test/timeline-selection.test.ts+++ b/packages/studio/src/test/timeline-selection.test.ts@@ -58,6 +58,8 @@ import {isTimelineSelectionModifierEvent,SELECTION_ENABLED,shouldSelectTimelineRowOnPointerDown,+ TIMELINE_BACKGROUND,+ TIMELINE_TICKS_BACKGROUND,TIMELINE_TOP_DRAG,timelineMarqueeRectsIntersect,} from '../components/Timeline/TimelineSelection';@@ -1174,6 +1176,11 @@ test('Timeline outlines should not be enabled', () => {expect(ENABLE_OUTLINES).toBe(false);});+test('Timeline colors should use the old palette when outlines are disabled', () => {+ expect(TIMELINE_BACKGROUND).toBe('#111');+ expect(TIMELINE_TICKS_BACKGROUND).toBe('#111');+});+test('Timeline outlines visibility is enabled by default and persisted', () => {withMockLocalStorage(() => {expect(loadEditorShowOutlinesOption()).toBe(true);