Skip to content

🎥 Make videos programmatically with React

Canvas Capture: Refine popup layout

Jonny Burger01e88394ef01
diff --git a/packages/canvas-capture-extension/src/entrypoints/recorder/App.tsx b/packages/canvas-capture-extension/src/entrypoints/recorder/App.tsx
index a103ed1817..7f2a9f8622 100644
--- a/packages/canvas-capture-extension/src/entrypoints/recorder/App.tsx
+++ b/packages/canvas-capture-extension/src/entrypoints/recorder/App.tsx
@@ -1,4 +1,4 @@
-import {Button, Card, Input} from '@remotion/design';
+import {Button, Slider} from '@remotion/design';
import {useCallback, useEffect, useRef, useState} from 'react';
import {browser} from 'wxt/browser';
import {
@@ -36,7 +36,7 @@ export const App: React.FC = () => {
const [connectionMessage, setConnectionMessage] = useState(
'Connecting to the selected tab…',
);
- const [scaleInput, setScaleInput] = useState('1');
+ const [scaleInput, setScaleInput] = useState(1);
const applyState = useCallback((nextState: CaptureControllerState) => {
currentState.current = nextState;
@@ -132,7 +132,7 @@ export const App: React.FC = () => {
useEffect(() => {
if (state && document.activeElement?.id !== 'scale') {
- setScaleInput(String(state.scale));
+ setScaleInput(state.scale);
}
}, [state]);
@@ -220,43 +220,9 @@ export const App: React.FC = () => {
<main className="app-shell">
<header className="header">
<img className="logo" src="/logo.svg" alt="" />
- <div>
- <h1>Canvas Capture</h1>
- <p>High-resolution recording for the web</p>
- </div>
+ <h1>Canvas Capture</h1>
</header>
- <Card className="panel settings-panel">
- <div className="field">
- <label>Format</label>
- <div className="format-value">
- {state?.format === 'webm' ? 'WebM · VP9' : 'MP4 · H.264'}
- </div>
- </div>
-
- <div className="field">
- <label htmlFor="scale">Scale</label>
- <div className="scale-control">
- <Input
- id="scale"
- type="number"
- min="0.1"
- step="0.1"
- disabled={setupDisabled || state?.recording}
- value={scaleInput}
- onChange={(event) => setScaleInput(event.currentTarget.value)}
- onBlur={() => updateOptions(Number(scaleInput))}
- onKeyDown={(event) => {
- if (event.key === 'Enter') {
- event.currentTarget.blur();
- }
- }}
- />
- <span>×</span>
- </div>
- </div>
- </Card>
-
<section className="capture-section">
<div className="section-label">Capture target</div>
<div className="button-row">
@@ -278,7 +244,6 @@ export const App: React.FC = () => {
.catch(() => undefined);
}}
>
- <span className="selection-icon" aria-hidden="true" />
{state?.selecting ? 'Cancel selection' : 'Select area'}
</Button>
<Button
@@ -291,14 +256,40 @@ export const App: React.FC = () => {
}).catch(() => undefined)
}
>
- <span className="page-icon" aria-hidden="true" />
Whole page
</Button>
</div>
- <Card className={`target-card${state?.hasTarget ? ' selected' : ''}`}>
- <span className="target-dot" />
- <span>{targetLabel}</span>
- </Card>
+ </section>
+
+ <section className="settings-panel">
+ <div className="field">
+ <label>Format</label>
+ <div className="format-value">
+ {state?.format === 'webm' ? 'WebM · VP9' : 'MP4 · H.264'}
+ </div>
+ </div>
+
+ <div className="field">
+ <label htmlFor="scale">Scale</label>
+ <div className="scale-control">
+ <Slider
+ id="scale"
+ min="0.1"
+ max="4"
+ step="0.1"
+ disabled={setupDisabled || state?.recording}
+ value={scaleInput}
+ onChange={setScaleInput}
+ onPointerUp={(event) =>
+ updateOptions(Number(event.currentTarget.value))
+ }
+ onKeyUp={(event) =>
+ updateOptions(Number(event.currentTarget.value))
+ }
+ />
+ <output htmlFor="scale">{Number(scaleInput.toFixed(1))}×</output>
+ </div>
+ </div>
</section>
<div className="actions">
@@ -353,10 +344,12 @@ export const App: React.FC = () => {
}).catch(() => undefined);
}}
>
- <span className="record-icon" aria-hidden="true" />
{state?.recording ? 'Stop recording' : 'Start recording'}
</Button>
)}
+ <div className={`target-summary${state?.hasTarget ? ' selected' : ''}`}>
+ {targetLabel}
+ </div>
</div>
<footer className={`status${statusIsError ? ' error' : ''}`}>
diff --git a/packages/canvas-capture-extension/src/entrypoints/recorder/style.css b/packages/canvas-capture-extension/src/entrypoints/recorder/style.css
index c3f48b3398..5441363796 100644
--- a/packages/canvas-capture-extension/src/entrypoints/recorder/style.css
+++ b/packages/canvas-capture-extension/src/entrypoints/recorder/style.css
@@ -55,8 +55,7 @@ input:focus-visible {
height: 36px;
}
-h1,
-p {
+h1 {
margin: 0;
}
@@ -66,24 +65,10 @@ h1 {
letter-spacing: -0.02em;
}
-.header p {
- margin-top: 1px;
- color: #555b61;
- font-size: 12px;
-}
-
-.panel,
-.target-card {
- border: 2px solid #000;
- border-bottom-width: 4px;
- border-radius: 8px;
- background: #fff;
- color: #000;
-}
-
.settings-panel {
display: grid;
- grid-template-columns: 1fr 1fr;
+ grid-template-columns: 1fr;
+ gap: 8px;
}
.field {
@@ -91,11 +76,6 @@ h1 {
min-width: 0;
flex-direction: column;
gap: 7px;
- padding: 11px;
-}
-
-.field + .field {
- border-left: 2px solid #000;
}
.field label,
@@ -103,11 +83,8 @@ h1 {
color: #555b61;
font-size: 11px;
font-weight: 700;
- letter-spacing: 0.04em;
- text-transform: uppercase;
}
-input,
.format-value {
width: 100%;
height: 36px;
@@ -124,25 +101,25 @@ input,
padding: 0 9px;
}
-input {
- padding: 0 8px;
- font-size: 13px;
-}
-
-input:disabled {
- cursor: default;
- opacity: 0.5;
-}
-
.scale-control {
display: flex;
align-items: center;
- gap: 7px;
+ gap: 10px;
+ height: 36px;
+ padding: 0 4px;
+}
+
+.scale-control .remotion-design-slider {
+ min-width: 0;
+ width: auto;
+ flex: 1;
}
-.scale-control span {
+.scale-control output {
+ min-width: 28px;
color: #555b61;
font-weight: 700;
+ text-align: right;
}
.capture-section {
@@ -164,7 +141,6 @@ input:disabled {
.record-button {
width: 100%;
height: 40px;
- gap: 8px;
border: 2px solid #000;
border-bottom-width: 4px;
border-radius: 8px;
@@ -180,35 +156,16 @@ input:disabled {
background: #eef1f4;
}
-.selection-icon {
- width: 13px;
- height: 13px;
- border: 1px dashed currentColor;
- border-radius: 2px;
-}
-
-.page-icon {
- width: 11px;
- height: 14px;
- border: 1px solid currentColor;
- border-radius: 1px;
-}
-
-.target-card {
- display: flex;
- min-height: 42px;
- align-items: center;
- gap: 9px;
- padding: 9px 11px;
+.target-summary {
color: #6b7177;
+ font-size: 12px;
overflow-wrap: anywhere;
}
-.target-card.selected {
+.target-summary.selected {
color: #000;
}
-.target-dot,
.status-dot {
width: 7px;
height: 7px;
@@ -217,11 +174,6 @@ input:disabled {
background: #9aa0a6;
}
-.target-card.selected .target-dot {
- background: #0b84f3;
- box-shadow: 0 0 0 3px rgba(11, 132, 243, 0.16);
-}
-
.actions {
display: flex;
flex-direction: column;
@@ -248,27 +200,10 @@ input:disabled {
background: #ff4b4b;
}
-.record-icon {
- width: 10px;
- height: 10px;
- border: 2px solid currentColor;
- border-radius: 50%;
-}
-
-.recording .record-icon {
- border-radius: 2px;
- background: currentColor;
-}
-
.completed-recording {
display: flex;
flex-direction: column;
gap: 10px;
- padding: 12px;
- border: 2px solid #000;
- border-bottom-width: 4px;
- border-radius: 8px;
- background: #e9f4ff;
}
.completed-title {