Skip to content

🎥 Make videos programmatically with React

Add bottom borders to timeline list rows

JonnyBurgerd7ba7cb5fc40
diff --git a/packages/studio/src/components/Timeline/TimelineExpandedSection.tsx b/packages/studio/src/components/Timeline/TimelineExpandedSection.tsx
index f8510522f1..1a1160bab5 100644
--- a/packages/studio/src/components/Timeline/TimelineExpandedSection.tsx
+++ b/packages/studio/src/components/Timeline/TimelineExpandedSection.tsx
@@ -22,6 +22,7 @@ const expandedSectionBase: React.CSSProperties = {
fontSize: 12,
display: 'flex',
flexDirection: 'column',
+ position: 'relative',
};
export const TimelineExpandedSection: React.FC<{
@@ -76,23 +77,32 @@ export const TimelineExpandedSection: React.FC<{
<TimelineRowSelectedBackgroundContext.Provider
value={TIMELINE_EXPANDED_SELECTED_BACKGROUND}
>
- <div style={style}>
- {flat.map(({node, depth}) => {
+ <div style={style} className="remotion-timeline-list-expanded-section">
+ {flat.map(({node, depth}, index) => {
return (
- <TimelineExpandedRow
+ <div
key={JSON.stringify(node.nodePathInfo)}
- node={node}
- depth={depth}
- nestedDepth={nestedDepth}
- getIsExpanded={getIsExpanded}
- toggleTrack={toggleTrack}
- validatedLocation={validatedLocation}
- nodePath={nodePathInfo.sequenceSubscriptionKey}
- schema={schema}
- keyframeDisplayOffset={keyframeDisplayOffset}
- keyframePlaybackRate={keyframePlaybackRate}
- keyframeControlsMode="timeline"
- />
+ className={
+ index < flat.length - 1
+ ? 'remotion-timeline-list-row-border'
+ : undefined
+ }
+ style={{height: getTreeRowHeight(node), position: 'relative'}}
+ >
+ <TimelineExpandedRow
+ node={node}
+ depth={depth}
+ nestedDepth={nestedDepth}
+ getIsExpanded={getIsExpanded}
+ toggleTrack={toggleTrack}
+ validatedLocation={validatedLocation}
+ nodePath={nodePathInfo.sequenceSubscriptionKey}
+ schema={schema}
+ keyframeDisplayOffset={keyframeDisplayOffset}
+ keyframePlaybackRate={keyframePlaybackRate}
+ keyframeControlsMode="timeline"
+ />
+ </div>
);
})}
</div>
diff --git a/packages/studio/src/components/Timeline/TimelineList.tsx b/packages/studio/src/components/Timeline/TimelineList.tsx
index 4d85afaa7f..beef94a863 100644
--- a/packages/studio/src/components/Timeline/TimelineList.tsx
+++ b/packages/studio/src/components/Timeline/TimelineList.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import {BACKGROUND} from '../../helpers/colors';
+import {BACKGROUND, TIMELINE_TRACK_SEPARATOR} from '../../helpers/colors';
import {TimelineSequenceItem} from './TimelineSequenceItem';
import {
type TimelineVirtualRow,
@@ -48,7 +48,24 @@ export const TimelineList: React.FC = () => {
return (
<div style={{...container, height: tracksEnd}}>
- <style>{`.remotion-timeline-sequence-name-measure::before {
+ <style>{`.remotion-timeline-list-row-border::after,
+ .remotion-timeline-list-expanded-section::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ right: 0;
+ height: 0;
+ border-bottom: 1px solid ${TIMELINE_TRACK_SEPARATOR};
+ pointer-events: none;
+ z-index: 1;
+ }
+ .remotion-timeline-list-row-border::after {
+ bottom: 0;
+ }
+ .remotion-timeline-list-expanded-section::before {
+ top: 0;
+ }
+ .remotion-timeline-sequence-name-measure::before {
content: attr(data-name);
display: block;
font-family: Arial, Helvetica, sans-serif;
@@ -59,6 +76,11 @@ export const TimelineList: React.FC = () => {
{virtualItems.map((virtualItem) => (
<div
key={virtualItem.key}
+ className={
+ virtualItem.index < rows.length - 1
+ ? 'remotion-timeline-list-row-border'
+ : undefined
+ }
style={{
height: virtualItem.size,
left: 0,