Skip to content

🎥 Make videos programmatically with React

components

Jonny Burgera362834c3ef6
diff --git a/packages/convert/app/components/timing-editor/Sidebar.tsx b/packages/convert/app/components/timing-editor/Sidebar.tsx
index 49395c68eb..bfb995b783 100644
--- a/packages/convert/app/components/timing-editor/Sidebar.tsx
+++ b/packages/convert/app/components/timing-editor/Sidebar.tsx
@@ -45,7 +45,6 @@ export const Sidebar: React.FC<{
<ReplayIcon />
</Button>
</div>
-
{components.map((component) => (
<TimingComponentEditor
key={component.id}
@@ -64,13 +63,15 @@ export const Sidebar: React.FC<{
canRemove={components.length > 1}
/>
))}
- <button
- type="button"
- onClick={addComponent}
- className="w-full px-3 py-2 text-sm border border-dashed border-[#444] text-[#888] hover:border-[#666] hover:text-[#aaa] rounded font-brand font-medium transition-colors"
- >
- + Add Timing Component
- </button>
+ <div className="flex row justify-center">
+ <Button
+ type="button"
+ onClick={addComponent}
+ className="px-3 py-0 text-sm h-9 rounded-full font-brand font-medium"
+ >
+ + Add component
+ </Button>
+ </div>
</div>
);
};
diff --git a/packages/convert/app/components/timing-editor/TimingComponentEditor.tsx b/packages/convert/app/components/timing-editor/TimingComponentEditor.tsx
index b854093015..e47808f4dc 100644
--- a/packages/convert/app/components/timing-editor/TimingComponentEditor.tsx
+++ b/packages/convert/app/components/timing-editor/TimingComponentEditor.tsx
@@ -1,10 +1,11 @@
-import {Card} from '@remotion/design';
+import {Button, Card} from '@remotion/design';
import React from 'react';
import {Tabs, TabsList, TabsTrigger} from '~/components/ui/tabs';
import {InterpolateEditor} from './InterpolateEditor';
import {SineEditor} from './SineEditor';
import {SpringEditor} from './SpringEditor';
import type {TimingComponent, TimingConfig} from './types';
+import {XIcon} from './x-icon';
export const TimingComponentEditor: React.FC<{
readonly component: TimingComponent;
@@ -30,8 +31,21 @@ export const TimingComponentEditor: React.FC<{
const config = draggedConfig ?? component.config;
return (
- <Card className="p-3 mb-3">
- <div className="flex items-center justify-between mb-2">
+ <Card className="p-3 mb-3 relative group">
+ {canRemove ? (
+ <div className="absolute -top-2 -right-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <Button
+ type="button"
+ onClick={onRemove}
+ className=" hover:text-white hover:bg-warn transition-colors w-6 h-6 p-0 rounded-full"
+ title="Remove timing component"
+ depth={0.5}
+ >
+ <XIcon />
+ </Button>
+ </div>
+ ) : null}
+ <div className="flex items-center justify-between mb-5">
<Tabs
value={config.type}
onValueChange={(value) =>
@@ -51,16 +65,6 @@ export const TimingComponentEditor: React.FC<{
</TabsTrigger>
</TabsList>
</Tabs>
- {canRemove ? (
- <button
- type="button"
- onClick={onRemove}
- className="ml-2 px-2 py-1 text-sm text-red-400 hover:text-red-300 hover:bg-red-900/30 rounded transition-colors"
- title="Remove timing component"
- >
- Remove
- </button>
- ) : null}
</div>
{config.type === 'spring' ? (
diff --git a/packages/convert/app/components/timing-editor/x-icon.tsx b/packages/convert/app/components/timing-editor/x-icon.tsx
new file mode 100644
index 0000000000..22884b6ab9
--- /dev/null
+++ b/packages/convert/app/components/timing-editor/x-icon.tsx
@@ -0,0 +1,15 @@
+import type {SVGProps} from 'react';
+
+export const XIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => {
+ return (
+ <svg
+ fill="currentcolor"
+ viewBox="0 0 640 640"
+ width={14}
+ height={14}
+ {...props}
+ >
+ <path d="M183.1 137.4C170.6 124.9 150.3 124.9 137.8 137.4C125.3 149.9 125.3 170.2 137.8 182.7L275.2 320L137.9 457.4C125.4 469.9 125.4 490.2 137.9 502.7C150.4 515.2 170.7 515.2 183.2 502.7L320.5 365.3L457.9 502.6C470.4 515.1 490.7 515.1 503.2 502.6C515.7 490.1 515.7 469.8 503.2 457.3L365.8 320L503.1 182.6C515.6 170.1 515.6 149.8 503.1 137.3C490.6 124.8 470.3 124.8 457.8 137.3L320.5 274.7L183.1 137.4z" />
+ </svg>
+ );
+};
diff --git a/packages/convert/app/tailwind.css b/packages/convert/app/tailwind.css
index e8a1e8bf04..3999f62846 100644
--- a/packages/convert/app/tailwind.css
+++ b/packages/convert/app/tailwind.css
@@ -41,6 +41,7 @@
--color-destructive-foreground: hsl(var(--destructive-foreground));
--color-brand: #0b84f3;
+ --color-warn: #ff3232;
--color-button-bg: white;
--color-text: black;
--color-card-bg: white;
diff --git a/packages/design/src/index.css b/packages/design/src/index.css
index d5178726e7..21208a1299 100644
--- a/packages/design/src/index.css
+++ b/packages/design/src/index.css
@@ -17,6 +17,7 @@
--font-brand: 'GTPlanar', sans-serif;
--font-brand--font-feature-settings: 'ss03' 1;
--color-brand: #0b84f3;
+ --color-warn: #ff3232;
--color-text: var(--text-color);
--color-button-bg: var(--plain-button);
--color-card-bg: white;
diff --git a/packages/example/src/style.css b/packages/example/src/style.css
index 5633b0a1e5..e9961eeff9 100644
--- a/packages/example/src/style.css
+++ b/packages/example/src/style.css
@@ -2,5 +2,6 @@
@theme inline {
--color-brand: #0b84f3;
+ --color-warn: #ff3232;
--font-brand: 'GT Planar', sans-serif;
}
diff --git a/packages/promo-pages/src/index.css b/packages/promo-pages/src/index.css
index a7f4296d57..1613645fd9 100644
--- a/packages/promo-pages/src/index.css
+++ b/packages/promo-pages/src/index.css
@@ -122,6 +122,7 @@ body {
--font-brand: 'GTPlanar', sans-serif;
--font-brand--font-feature-settings: 'ss03' 1;
--color-brand: #0b84f3;
+ --color-warn: #ff3232;
--color-text: var(--text-color);
--color-button-bg: var(--plain-button);
--color-card-bg: var(--card-bg);