Skip to content

🎥 Make videos programmatically with React

condense

Jonny Burgerb535cbe9cd3f
diff --git a/packages/studio/src/components/Timeline/TimelineEffectGroupRow.tsx b/packages/studio/src/components/Timeline/TimelineEffectGroupRow.tsx
index bbc8c7205c..211ebbf4ca 100644
--- a/packages/studio/src/components/Timeline/TimelineEffectGroupRow.tsx
+++ b/packages/studio/src/components/Timeline/TimelineEffectGroupRow.tsx
@@ -18,8 +18,8 @@ import {TimelineExpandArrowButton} from './TimelineExpandArrowButton';
import {TimelineLayerEye, TimelineLayerEyeSpacer} from './TimelineLayerEye';
import {TimelineRowChrome} from './TimelineRowChrome';
import {
+ getTimelineColor,
getTimelineSelectedLabelStyle,
- TIMELINE_SELECTED_LABEL_TEXT,
useTimelineRowSelection,
} from './TimelineSelection';
@@ -190,7 +190,7 @@ export const TimelineEffectGroupRow: React.FC<{
...getTimelineSelectedLabelStyle(selection.selected, true),
alignSelf: 'stretch',
alignItems: 'center',
- color: selection.selected ? TIMELINE_SELECTED_LABEL_TEXT : rowLabel.color,
+ color: getTimelineColor(selection.selected, true),
display: 'flex',
flex: 1,
minWidth: 0,
diff --git a/packages/studio/src/components/Timeline/TimelineExpandedRow.tsx b/packages/studio/src/components/Timeline/TimelineExpandedRow.tsx
index 63ff231bf3..e37a6a8c2c 100644
--- a/packages/studio/src/components/Timeline/TimelineExpandedRow.tsx
+++ b/packages/studio/src/components/Timeline/TimelineExpandedRow.tsx
@@ -20,8 +20,8 @@ import {TimelineFieldRow} from './TimelineFieldRow';
import {TimelineLayerEyeSpacer} from './TimelineLayerEye';
import {TimelineRowChrome} from './TimelineRowChrome';
import {
+ getTimelineColor,
getTimelineSelectedLabelStyle,
- TIMELINE_SELECTED_LABEL_TEXT,
useTimelineRowSelection,
} from './TimelineSelection';
@@ -58,7 +58,7 @@ export const TimelineExpandedRow: React.FC<{
...getTimelineSelectedLabelStyle(selection.selected, true),
alignSelf: 'stretch',
alignItems: 'center',
- color: selection.selected ? TIMELINE_SELECTED_LABEL_TEXT : rowLabel.color,
+ color: getTimelineColor(selection.selected, true),
display: 'flex',
flex: 1,
minWidth: 0,
@@ -85,6 +85,7 @@ export const TimelineExpandedRow: React.FC<{
);
}
+ // Group like "Effects"
const isExpanded = getIsExpanded(node.nodePathInfo);
return (
<TimelineRowChrome
diff --git a/packages/studio/src/components/Timeline/TimelineListItem.tsx b/packages/studio/src/components/Timeline/TimelineListItem.tsx
index a60c934130..9049afe341 100644
--- a/packages/studio/src/components/Timeline/TimelineListItem.tsx
+++ b/packages/studio/src/components/Timeline/TimelineListItem.tsx
@@ -22,7 +22,6 @@ import {
TimelineExpandArrowSpacer,
} from './TimelineExpandArrowButton';
import {TimelineExpandedSection} from './TimelineExpandedSection';
-import {TimelineItemName} from './TimelineItemName';
import {TimelineItemStack} from './TimelineItemStack';
import {TimelineLayerEye, TimelineLayerEyeSpacer} from './TimelineLayerEye';
import {TimelineMediaInfo} from './TimelineMediaInfo';
@@ -31,6 +30,7 @@ import {
useTimelineRowContainsSelection,
useTimelineRowSelection,
} from './TimelineSelection';
+import {TimelineSequenceName} from './TimelineSequenceName';
import {useResolveStackAndReactToChange} from './use-resolved-stack-react-to-change';
const labelContainerStyle: React.CSSProperties = {
@@ -344,7 +344,7 @@ export const TimelineListItem: React.FC<{
outerHeight={outerHeight}
>
<div style={labelContainerStyle}>
- <TimelineItemName
+ <TimelineSequenceName
sequence={sequence}
selected={selected}
containsSelection={containsSelection}
diff --git a/packages/studio/src/components/Timeline/TimelineItemName.tsx b/packages/studio/src/components/Timeline/TimelineSequenceName.tsx
similarity index 91%
rename from packages/studio/src/components/Timeline/TimelineItemName.tsx
rename to packages/studio/src/components/Timeline/TimelineSequenceName.tsx
index 833dc4277e..3b49fdcbfc 100644
--- a/packages/studio/src/components/Timeline/TimelineItemName.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSequenceName.tsx
@@ -1,10 +1,9 @@
import React, {useCallback, useMemo, useState} from 'react';
import type {TSequence} from 'remotion';
-import {LIGHT_COLOR} from '../../helpers/colors';
import {
+ getTimelineColor,
getTimelineSelectedLabelStyle,
TIMELINE_SELECTED_LABEL_BACKGROUND,
- TIMELINE_SELECTED_LABEL_TEXT,
} from './TimelineSelection';
const MAX_DISPLAY_NAME_LENGTH = 1000;
@@ -17,7 +16,7 @@ const getTruncatedDisplayName = (displayName: string): string => {
return displayName;
};
-export const TimelineItemName: React.FC<{
+export const TimelineSequenceName: React.FC<{
readonly sequence: TSequence;
readonly selected: boolean;
readonly containsSelection: boolean;
@@ -48,7 +47,7 @@ export const TimelineItemName: React.FC<{
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
overflow: 'hidden',
- color: selected ? TIMELINE_SELECTED_LABEL_TEXT : LIGHT_COLOR,
+ color: getTimelineColor(selected, false),
userSelect: 'none',
WebkitUserSelect: 'none',
textDecoration: hoverEffect ? 'underline' : 'none',
diff --git a/packages/studio/src/helpers/timeline-layout.ts b/packages/studio/src/helpers/timeline-layout.ts
index 64e845edd3..816f0698cc 100644
--- a/packages/studio/src/helpers/timeline-layout.ts
+++ b/packages/studio/src/helpers/timeline-layout.ts
@@ -241,13 +241,13 @@ export const getExpandedTrackHeight = ({
return totalRowsHeight + separators;
};
-export const TIMELINE_LAYER_FILMSTRIP_HEIGHT = 36;
+export const TIMELINE_LAYER_FILMSTRIP_HEIGHT = 26;
// The waveform stripe rendered underneath the filmstrip in TimelineVideoInfo.
export const TIMELINE_VIDEO_INFO_WAVEFORM_HEIGHT = 25;
export const TIMELINE_LAYER_HEIGHT_VIDEO =
2 + TIMELINE_LAYER_FILMSTRIP_HEIGHT + TIMELINE_VIDEO_INFO_WAVEFORM_HEIGHT;
-export const TIMELINE_LAYER_HEIGHT_IMAGE = 42;
+export const TIMELINE_LAYER_HEIGHT_IMAGE = 26;
export const TIMELINE_LAYER_HEIGHT_AUDIO = 34;
export const TIMELINE_LAYER_HEIGHT_DEFAULT = 21;
// The horizontal row inside a timeline list item (eye + arrow + label).