🎥 Make videos programmatically with React
small refactor
Jonny Burger445d2764633d
diff --git a/packages/cli/src/editor/components/CopyButton.tsx b/packages/cli/src/editor/components/CopyButton.tsxindex c174d7cb62..34933093eb 100644--- a/packages/cli/src/editor/components/CopyButton.tsx+++ b/packages/cli/src/editor/components/CopyButton.tsx@@ -6,6 +6,12 @@ import {import {copyCmd} from '../helpers/copy-text';import {Row, Spacing} from './layout';+const iconStyle: React.CSSProperties = {+ width: 16,+ height: 16,+ color: 'white',+};+const copyIcon = (<svgaria-hidden="true"@@ -16,7 +22,7 @@ const copyIcon = (role="img"xmlns="http://www.w3.org/2000/svg"viewBox="0 0 384 512"- style={{width: 16, height: 16, color: 'white'}}+ style={iconStyle}><pathfill="currentColor"diff --git a/packages/cli/src/editor/components/FpsCounter.tsx b/packages/cli/src/editor/components/FpsCounter.tsxindex d4b7b0a111..afd9850741 100644--- a/packages/cli/src/editor/components/FpsCounter.tsx+++ b/packages/cli/src/editor/components/FpsCounter.tsx@@ -1,4 +1,10 @@-import React, {useEffect, useLayoutEffect, useRef, useState} from 'react';+import React, {+ useEffect,+ useLayoutEffect,+ useMemo,+ useRef,+ useState,+} from 'react';import {Internals} from 'remotion';const label: React.CSSProperties = {@@ -65,6 +71,17 @@ export const FpsCounter: React.FC = () => {}}, [marker, playing]);+ const style = useMemo(() => {+ if (!videoConfig) {+ return {};+ }++ return {+ ...label,+ color: fps < videoConfig.fps * 0.9 ? 'red' : 'white',+ };+ }, [fps, videoConfig]);+if (fps === 0) {return null;}@@ -77,9 +94,5 @@ export const FpsCounter: React.FC = () => {return null;}- const style = {- ...label,- color: fps < videoConfig.fps * 0.9 ? 'red' : 'white',- };return <div style={style}>{fps.toFixed(1)} FPS</div>;};diff --git a/packages/cli/src/editor/components/KeyboardShortcutsModal.tsx b/packages/cli/src/editor/components/KeyboardShortcutsModal.tsxindex ad99bdec55..de6833baaa 100644--- a/packages/cli/src/editor/components/KeyboardShortcutsModal.tsx+++ b/packages/cli/src/editor/components/KeyboardShortcutsModal.tsx@@ -60,7 +60,7 @@ export const KeyboardShortcuts: React.FC = () => {<div style={left}><kbd style={key}><ArrowLeft />- </kbd>{' '}+ </kbd></div><div style={right}>Previous frame</div></Row>@@ -86,7 +86,7 @@ export const KeyboardShortcuts: React.FC = () => {<Spacing x={0.3} /><kbd style={key}><ArrowRight />- </kbd>{' '}+ </kbd></div><div style={right}>1 second forward</div></Row>diff --git a/packages/cli/src/editor/components/Menu/MenuDivider.tsx b/packages/cli/src/editor/components/Menu/MenuDivider.tsxindex c0925b80d9..4d71ef405c 100644--- a/packages/cli/src/editor/components/Menu/MenuDivider.tsx+++ b/packages/cli/src/editor/components/Menu/MenuDivider.tsx@@ -1,10 +1,11 @@import React from 'react';+import {INPUT_BORDER_COLOR_HOVERED} from '../../helpers/colors';const menuDivider: React.CSSProperties = {marginTop: 4,marginBottom: 4,height: 1,- backgroundColor: 'rgba(255, 255, 255, 0.05)',+ backgroundColor: INPUT_BORDER_COLOR_HOVERED,};export const MenuDivider: React.FC = () => {diff --git a/packages/cli/src/editor/icons/keys.tsx b/packages/cli/src/editor/icons/keys.tsxindex c9165a5c57..14e0dc7ab7 100644--- a/packages/cli/src/editor/icons/keys.tsx+++ b/packages/cli/src/editor/icons/keys.tsx@@ -1,8 +1,12 @@import React from 'react';+const iconStyle: React.CSSProperties = {+ width: 10,+};+export const ShiftIcon: React.FC = () => {return (- <svg style={{width: 10}} viewBox="0 0 448 512">+ <svg style={iconStyle} viewBox="0 0 448 512"><pathfill="currentColor"d="M48.048 304h73.798v128c0 26.51 21.49 48 48 48h108.308c26.51 0 48-21.49 48-48V304h73.789c42.638 0 64.151-51.731 33.941-81.941l-175.943-176c-18.745-18.745-49.137-18.746-67.882 0l-175.952 176C-16.042 252.208 5.325 304 48.048 304zM224 80l176 176H278.154v176H169.846V256H48L224 80z"@@ -13,7 +17,7 @@ export const ShiftIcon: React.FC = () => {export const ArrowLeft: React.FC = () => {return (- <svg style={{width: 10}} viewBox="0 0 448 512">+ <svg style={iconStyle} viewBox="0 0 448 512"><pathfill="currentColor"d="M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"@@ -24,7 +28,7 @@ export const ArrowLeft: React.FC = () => {export const ArrowRight: React.FC = () => {return (- <svg style={{width: 10}} viewBox="0 0 448 512">+ <svg style={iconStyle} viewBox="0 0 448 512"><pathfill="currentColor"d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"