Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Account for parent padder in expanded row padding

Jonny Burgerad2229e22faf
diff --git a/packages/studio/src/components/Timeline/TimelineExpandedSection.tsx b/packages/studio/src/components/Timeline/TimelineExpandedSection.tsx
index d8d9d53606..19212bc099 100644
--- a/packages/studio/src/components/Timeline/TimelineExpandedSection.tsx
+++ b/packages/studio/src/components/Timeline/TimelineExpandedSection.tsx
@@ -31,7 +31,8 @@ const separator: React.CSSProperties = {
export const TimelineExpandedSection: React.FC<{
readonly sequence: TSequence;
readonly originalLocation: OriginalPosition | null;
-}> = ({sequence, originalLocation}) => {
+ readonly nestedDepth: number;
+}> = ({sequence, originalLocation, nestedDepth}) => {
const overrideId = sequence.controls?.overrideId ?? sequence.id;
const schemaFields = useMemo(
() => getSchemaFields(sequence.controls),
@@ -77,6 +78,7 @@ export const TimelineExpandedSection: React.FC<{
field={field}
overrideId={overrideId}
validatedLocation={validatedLocation}
+ nestedDepth={nestedDepth}
/>
</React.Fragment>
);
diff --git a/packages/studio/src/components/Timeline/TimelineFieldRow.tsx b/packages/studio/src/components/Timeline/TimelineFieldRow.tsx
index 56bed6b57c..5823e013b4 100644
--- a/packages/studio/src/components/Timeline/TimelineFieldRow.tsx
+++ b/packages/studio/src/components/Timeline/TimelineFieldRow.tsx
@@ -8,15 +8,15 @@ import {
EXPANDED_SECTION_PADDING_LEFT,
EXPANDED_SECTION_PADDING_RIGHT,
} from './TimelineExpandedSection';
+import {SPACING} from './TimelineListItem';
import {TimelineFieldValue} from './TimelineSchemaField';
const FIELD_ROW_PADDING_LEFT = 24;
-const fieldRow: React.CSSProperties = {
+const fieldRowBase: React.CSSProperties = {
display: 'flex',
alignItems: 'center',
gap: 8,
- paddingLeft: EXPANDED_SECTION_PADDING_LEFT + FIELD_ROW_PADDING_LEFT,
paddingRight: EXPANDED_SECTION_PADDING_RIGHT,
};
@@ -37,7 +37,8 @@ export const TimelineFieldRow: React.FC<{
readonly field: SchemaFieldInfo;
readonly overrideId: string;
readonly validatedLocation: CodePosition | null;
-}> = ({field, overrideId, validatedLocation}) => {
+ readonly nestedDepth: number;
+}> = ({field, overrideId, validatedLocation, nestedDepth}) => {
const {
setDragOverrides,
clearDragOverrides,
@@ -106,10 +107,14 @@ export const TimelineFieldRow: React.FC<{
const style = useMemo(() => {
return {
- ...fieldRow,
+ ...fieldRowBase,
height: field.rowHeight,
+ paddingLeft:
+ EXPANDED_SECTION_PADDING_LEFT +
+ FIELD_ROW_PADDING_LEFT +
+ SPACING * 3 * nestedDepth,
};
- }, [field.rowHeight]);
+ }, [field.rowHeight, nestedDepth]);
return (
<div style={style}>
diff --git a/packages/studio/src/components/Timeline/TimelineListItem.tsx b/packages/studio/src/components/Timeline/TimelineListItem.tsx
index 0817c092a2..a66d1559dd 100644
--- a/packages/studio/src/components/Timeline/TimelineListItem.tsx
+++ b/packages/studio/src/components/Timeline/TimelineListItem.tsx
@@ -14,7 +14,7 @@ import {TimelineStack} from './TimelineStack';
import {useResolvedStack} from './use-resolved-stack';
import {useSequencePropsSubscription} from './use-sequence-props-subscription';
-const SPACING = 5;
+export const SPACING = 5;
const space: React.CSSProperties = {
width: SPACING,
@@ -66,7 +66,7 @@ export const TimelineListItem: React.FC<{
const padder = useMemo((): React.CSSProperties => {
return {
- width: Number(SPACING * 1.5) * nestedDepth,
+ width: Number(SPACING * 3) * nestedDepth,
flexShrink: 0,
};
}, [nestedDepth]);
@@ -153,6 +153,7 @@ export const TimelineListItem: React.FC<{
<TimelineExpandedSection
sequence={sequence}
originalLocation={originalLocation}
+ nestedDepth={nestedDepth}
/>
) : null}
</>