Skip to content

🎥 Make videos programmatically with React

awesome

Jonny Burger01dd45c7dd51
diff --git a/packages/cli/src/editor/components/CompositionSelectorItem.tsx b/packages/cli/src/editor/components/CompositionSelectorItem.tsx
index 68b02c50b7..0f4348641a 100644
--- a/packages/cli/src/editor/components/CompositionSelectorItem.tsx
+++ b/packages/cli/src/editor/components/CompositionSelectorItem.tsx
@@ -8,16 +8,16 @@ import {
SELECTED_BACKGROUND,
} from '../helpers/colors';
import {isCompositionStill} from '../helpers/is-composition-still';
-import {FilmIcon} from '../icons/film';
import {CollapsedFolderIcon, ExpandedFolderIcon} from '../icons/folder';
import {StillIcon} from '../icons/still';
+import {FilmIcon} from '../icons/video';
import {Row, Spacing} from './layout';
import {RenderButton} from './RenderButton';
const COMPOSITION_ITEM_HEIGHT = 32;
const itemStyle: React.CSSProperties = {
- paddingRight: 8,
+ paddingRight: 10,
paddingTop: 6,
paddingBottom: 6,
fontSize: 13,
@@ -103,7 +103,7 @@ export const CompositionSelectorItem: React.FC<{
? SELECTED_BACKGROUND
: 'transparent',
color: selected || hovered ? 'white' : LIGHT_TEXT,
- paddingLeft: 8 + level * 8,
+ paddingLeft: 12 + level * 8,
};
}, [hovered, level, selected]);
@@ -138,9 +138,15 @@ export const CompositionSelectorItem: React.FC<{
type="button"
>
{item.expanded ? (
- <ExpandedFolderIcon style={iconStyle} />
+ <ExpandedFolderIcon
+ style={iconStyle}
+ color={hovered ? 'white' : LIGHT_TEXT}
+ />
) : (
- <CollapsedFolderIcon style={iconStyle} />
+ <CollapsedFolderIcon
+ color={hovered ? 'white' : LIGHT_TEXT}
+ style={iconStyle}
+ />
)}
<Spacing x={1} />
{item.folderName}
@@ -175,9 +181,9 @@ export const CompositionSelectorItem: React.FC<{
type="button"
>
{isCompositionStill(item.composition) ? (
- <StillIcon style={iconStyle} />
+ <StillIcon color={hovered ? 'white' : LIGHT_TEXT} style={iconStyle} />
) : (
- <FilmIcon style={iconStyle} />
+ <FilmIcon color={hovered ? 'white' : LIGHT_TEXT} style={iconStyle} />
)}
<Spacing x={1} />
<div style={label}>{item.composition.id}</div>
diff --git a/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherResult.tsx b/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherResult.tsx
index 305ab7e829..fb76f7be60 100644
--- a/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherResult.tsx
+++ b/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherResult.tsx
@@ -1,8 +1,8 @@
import React, {useEffect, useMemo, useRef, useState} from 'react';
import {getBackgroundFromHoverState, LIGHT_TEXT} from '../../helpers/colors';
import {useKeybinding} from '../../helpers/use-keybinding';
-import {FilmIcon} from '../../icons/film';
import {StillIcon} from '../../icons/still';
+import {FilmIcon} from '../../icons/video';
import {Spacing} from '../layout';
type QuickSwitcherResultDetail =
@@ -137,9 +137,12 @@ export const QuickSwitcherResult: React.FC<{
<div ref={ref} key={result.id} style={style} onClick={result.onSelected}>
{result.type === 'composition' ? (
result.compositionType === 'still' ? (
- <StillIcon style={iconStyle} />
+ <StillIcon
+ color={selected ? 'white' : LIGHT_TEXT}
+ style={iconStyle}
+ />
) : (
- <FilmIcon style={iconStyle} />
+ <FilmIcon color={selected ? 'white' : LIGHT_TEXT} style={iconStyle} />
)
) : null}
<Spacing x={1} />
diff --git a/packages/cli/src/editor/icons/film.tsx b/packages/cli/src/editor/icons/film.tsx
deleted file mode 100644
index 889dba50d9..0000000000
--- a/packages/cli/src/editor/icons/film.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import type {SVGProps} from 'react';
-import React from 'react';
-
-export const FilmIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => {
- return (
- <svg viewBox="0 0 512 512" {...props}>
- <path
- fill="currentColor"
- d="M488 64h-8v20c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12V64H96v20c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12V64h-8C10.7 64 0 74.7 0 88v336c0 13.3 10.7 24 24 24h8v-20c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v20h320v-20c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v20h8c13.3 0 24-10.7 24-24V88c0-13.3-10.7-24-24-24zM96 372c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm280 208c0 6.6-5.4 12-12 12H148c-6.6 0-12-5.4-12-12V124c0-6.6 5.4-12 12-12h216c6.6 0 12 5.4 12 12v264zm104-16c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40z"
- />
- </svg>
- );
-};
diff --git a/packages/cli/src/editor/icons/folder.tsx b/packages/cli/src/editor/icons/folder.tsx
index c2e4ebcd28..25d5df3ed5 100644
--- a/packages/cli/src/editor/icons/folder.tsx
+++ b/packages/cli/src/editor/icons/folder.tsx
@@ -1,27 +1,31 @@
import type {SVGProps} from 'react';
import React from 'react';
-export const CollapsedFolderIcon: React.FC<SVGProps<SVGSVGElement>> = (
- props
-) => {
+export const CollapsedFolderIcon: React.FC<
+ SVGProps<SVGSVGElement> & {
+ color: string;
+ }
+> = ({color, ...props}) => {
return (
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" {...props}>
+ <svg viewBox="0 0 512 512" {...props}>
<path
- fill="white"
- d="M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z"
+ fill={color}
+ d="M447.1 96H272L226.7 50.75C214.7 38.74 198.5 32 181.5 32H63.1c-35.35 0-64 28.65-64 64v320c0 35.35 28.65 64 64 64h384c35.35 0 64-28.65 64-64V160C511.1 124.7 483.3 96 447.1 96zM480 416c0 17.64-14.36 32-32 32H64c-17.64 0-32-14.36-32-32V96c0-17.64 14.36-32 32-32h117.5c8.549 0 16.58 3.328 22.63 9.375L258.7 128H448c17.64 0 32 14.36 32 32V416z"
/>
</svg>
);
};
-export const ExpandedFolderIcon: React.FC<SVGProps<SVGSVGElement>> = (
- props
-) => {
+export const ExpandedFolderIcon: React.FC<
+ SVGProps<SVGSVGElement> & {
+ color: string;
+ }
+> = ({color, ...props}) => {
return (
- <svg {...props} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
+ <svg viewBox="0 0 576 512" {...props}>
<path
- fill="white"
- d="M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"
+ fill={color}
+ d="M566.6 211.6C557.5 199.1 543.4 192 527.1 192H134.2C114.3 192 96.2 204.5 89.23 223.1L32 375.8V96c0-17.64 14.36-32 32-32h117.5c8.549 0 16.58 3.328 22.63 9.375L258.7 128H448c17.64 0 32 14.36 32 32h32c0-35.35-28.65-64-64-64H272L226.7 50.75C214.7 38.74 198.5 32 181.5 32H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h403.1c21.11 0 39.53-13.53 45.81-33.69l60-192C578.4 239.6 575.8 224 566.6 211.6zM543.2 244.8l-60 192C481.1 443.5 475 448 467.1 448H64c-3.322 0-6.357-.9551-9.373-1.898c-2.184-1.17-4.109-2.832-5.596-4.977c-3.031-4.375-3.703-9.75-1.828-14.73l72-192C121.5 228.2 127.5 224 134.2 224h393.8c5.141 0 9.844 2.375 12.89 6.516C543.9 234.7 544.8 239.9 543.2 244.8z"
/>
</svg>
);
diff --git a/packages/cli/src/editor/icons/still.tsx b/packages/cli/src/editor/icons/still.tsx
index 8c6b14d190..dda0125f02 100644
--- a/packages/cli/src/editor/icons/still.tsx
+++ b/packages/cli/src/editor/icons/still.tsx
@@ -1,12 +1,16 @@
import type {SVGProps} from 'react';
import React from 'react';
-export const StillIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => {
+export const StillIcon: React.FC<
+ SVGProps<SVGSVGElement> & {
+ color: string;
+ }
+> = ({color, ...props}) => {
return (
- <svg viewBox="0 0 512 512" {...props}>
+ <svg {...props} viewBox="0 0 512 512">
<path
- fill="currentColor"
- d="M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm-6 336H54a6 6 0 0 1-6-6V118a6 6 0 0 1 6-6h404a6 6 0 0 1 6 6v276a6 6 0 0 1-6 6zM128 152c-22.091 0-40 17.909-40 40s17.909 40 40 40 40-17.909 40-40-17.909-40-40-40zM96 352h320v-80l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L192 304l-39.515-39.515c-4.686-4.686-12.284-4.686-16.971 0L96 304v48z"
+ fill={color}
+ d="M144 288C144 226.1 194.1 176 256 176C317.9 176 368 226.1 368 288C368 349.9 317.9 400 256 400C194.1 400 144 349.9 144 288zM256 208C211.8 208 176 243.8 176 288C176 332.2 211.8 368 256 368C300.2 368 336 332.2 336 288C336 243.8 300.2 208 256 208zM362.9 64.82L373.3 96H448C483.3 96 512 124.7 512 160V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V160C0 124.7 28.65 96 64 96H138.7L149.1 64.82C155.6 45.22 173.9 32 194.6 32H317.4C338.1 32 356.4 45.22 362.9 64.82H362.9zM64 128C46.33 128 32 142.3 32 160V416C32 433.7 46.33 448 64 448H448C465.7 448 480 433.7 480 416V160C480 142.3 465.7 128 448 128H350.3L332.6 74.94C330.4 68.41 324.3 64 317.4 64H194.6C187.7 64 181.6 68.41 179.4 74.94L161.7 128H64z"
/>
</svg>
);
diff --git a/packages/cli/src/editor/icons/video.tsx b/packages/cli/src/editor/icons/video.tsx
new file mode 100644
index 0000000000..63215bdf26
--- /dev/null
+++ b/packages/cli/src/editor/icons/video.tsx
@@ -0,0 +1,17 @@
+import type {SVGProps} from 'react';
+import React from 'react';
+
+export const FilmIcon: React.FC<
+ SVGProps<SVGSVGElement> & {
+ color: string;
+ }
+> = ({color, ...props}) => {
+ return (
+ <svg {...props} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
+ <path
+ fill={color}
+ d="M448 32H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h384c35.35 0 64-28.65 64-64V96C512 60.65 483.3 32 448 32zM384 64v176H128V64H384zM32 96c0-17.64 14.36-32 32-32h32v80H32V96zM32 176h64v64H32V176zM32 272h64v64H32V272zM64 448c-17.64 0-32-14.36-32-32v-48h64V448H64zM128 448V272h256V448H128zM480 416c0 17.64-14.36 32-32 32h-32v-80h64V416zM480 336h-64v-64h64V336zM480 240h-64v-64h64V240zM480 144h-64V64h32c17.64 0 32 14.36 32 32V144z"
+ />
+ </svg>
+ );
+};