Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Standardize toolbar controls (#10052)

Jonny Burger198026df3d41
diff --git a/packages/bundler/src/setup-environment.ts b/packages/bundler/src/setup-environment.ts
index 13af957b13..57f16056ac 100644
--- a/packages/bundler/src/setup-environment.ts
+++ b/packages/bundler/src/setup-environment.ts
@@ -140,7 +140,6 @@ injectCSS(`
.__remotion-timeline-slider {
appearance: none;
- width: 100px;
border-radius: 3px;
height: 6px;
background-color: rgba(255, 255, 255, 0.1);
diff --git a/packages/player/src/BufferingIndicator.tsx b/packages/player/src/BufferingIndicator.tsx
index ac1f3ca4fb..17c560d62c 100644
--- a/packages/player/src/BufferingIndicator.tsx
+++ b/packages/player/src/BufferingIndicator.tsx
@@ -23,7 +23,8 @@ const studioStyle: React.CSSProperties = {
export const BufferingIndicator: React.FC<{
readonly type: 'player' | 'studio';
-}> = ({type}) => {
+ readonly color?: string;
+}> = ({type, color = 'white'}) => {
const style: React.CSSProperties =
type === 'player' ? playerStyle : studioStyle;
return (
@@ -54,7 +55,7 @@ export const BufferingIndicator: React.FC<{
? 'M 11 4 A 7 7 0 0 1 15.1145 16.66312'
: 'M 9 2 A 7 7 0 0 1 13.1145 14.66312'
}
- stroke="white"
+ stroke={color}
strokeLinecap="round"
fill="none"
strokeWidth={3}
diff --git a/packages/studio/src/components/CheckboardToggle.tsx b/packages/studio/src/components/CheckboardToggle.tsx
index 578415d8f8..3de9d1028d 100644
--- a/packages/studio/src/components/CheckboardToggle.tsx
+++ b/packages/studio/src/components/CheckboardToggle.tsx
@@ -1,6 +1,6 @@
import React, {useCallback, useContext} from 'react';
import {NoReactInternals} from 'remotion/no-react';
-import {BLUE, WHITE} from '../helpers/colors';
+import {BLUE} from '../helpers/colors';
import {areKeyboardShortcutsDisabled} from '../helpers/use-keybinding';
import {CheckerboardContext} from '../state/checkerboard';
import {ControlButton} from './ControlButton';
@@ -27,33 +27,35 @@ export const CheckboardToggle: React.FC = () => {
aria-label={accessibilityLabel}
onClick={onClick}
>
- <svg
- aria-hidden="true"
- focusable="false"
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 512 512"
- style={{width: 18, height: 18}}
- fill="none"
- >
- <path
- fill={checkerboard ? BLUE : WHITE}
- d="M256 48h184c13.3 0 24 10.7 24 24v184H256V48zM48 256h208v208H72c-13.3 0-24-10.7-24-24V256z"
- />
- <rect
- x="48"
- y="48"
- width="416"
- height="416"
- rx="24"
- stroke={checkerboard ? BLUE : WHITE}
- strokeWidth="32"
- />
- <path
- d="M256 48v416M48 256h416"
- stroke={checkerboard ? BLUE : WHITE}
- strokeWidth="32"
- />
- </svg>
+ {(color) => (
+ <svg
+ aria-hidden="true"
+ focusable="false"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 512 512"
+ style={{width: 18, height: 18}}
+ fill="none"
+ >
+ <path
+ fill={checkerboard ? BLUE : color}
+ d="M256 48h184c13.3 0 24 10.7 24 24v184H256V48zM48 256h208v208H72c-13.3 0-24-10.7-24-24V256z"
+ />
+ <rect
+ x="48"
+ y="48"
+ width="416"
+ height="416"
+ rx="24"
+ stroke={checkerboard ? BLUE : color}
+ strokeWidth="32"
+ />
+ <path
+ d="M256 48v416M48 256h416"
+ stroke={checkerboard ? BLUE : color}
+ strokeWidth="32"
+ />
+ </svg>
+ )}
</ControlButton>
);
};
diff --git a/packages/studio/src/components/ControlButton.tsx b/packages/studio/src/components/ControlButton.tsx
index eb81eefa00..7b4f606a25 100644
--- a/packages/studio/src/components/ControlButton.tsx
+++ b/packages/studio/src/components/ControlButton.tsx
@@ -1,34 +1,32 @@
-import React, {useMemo} from 'react';
-import {useZIndex} from '../state/z-index';
+import React from 'react';
+import {WHITE_ALPHA_80} from '../helpers/colors';
+import type {RenderInlineAction} from './InlineAction';
+import {InlineAction} from './InlineAction';
export const CONTROL_BUTTON_PADDING = 6;
-export const CONTROL_BUTTON_SIZE = 30;
export const ControlButton = (
- props: React.DetailedHTMLProps<
+ props: Omit<
React.ButtonHTMLAttributes<HTMLButtonElement>,
- HTMLButtonElement
+ 'children' | 'onClick' | 'title'
> & {
readonly title: string;
+ readonly onClick: React.MouseEventHandler<HTMLButtonElement>;
+ readonly children: React.ReactNode | RenderInlineAction;
},
) => {
- const style = useMemo((): React.CSSProperties => {
- return {
- opacity: props.disabled ? 0.5 : 1,
- display: 'inline-flex',
- alignItems: 'center',
- justifyContent: 'center',
- width: CONTROL_BUTTON_SIZE,
- height: CONTROL_BUTTON_SIZE,
- flexShrink: 0,
- background: 'none',
- border: 'none',
- padding: 0,
- };
- }, [props.disabled]);
+ const {children, onClick, title, ...buttonProps} = props;
+ const renderAction: RenderInlineAction =
+ typeof children === 'function' ? children : () => children;
- const {tabIndex} = useZIndex();
return (
- <button type={'button'} tabIndex={tabIndex} {...props} style={style} />
+ <InlineAction
+ {...buttonProps}
+ title={title}
+ onClick={onClick}
+ renderAction={renderAction}
+ variant={null}
+ unhoveredColor={WHITE_ALPHA_80}
+ />
);
};
diff --git a/packages/studio/src/components/FullscreenToggle.tsx b/packages/studio/src/components/FullscreenToggle.tsx
index 145a1f5c81..31c8c02df4 100644
--- a/packages/studio/src/components/FullscreenToggle.tsx
+++ b/packages/studio/src/components/FullscreenToggle.tsx
@@ -1,7 +1,6 @@
import {useCallback, useContext, useEffect} from 'react';
import {Internals} from 'remotion';
import {NoReactInternals} from 'remotion/no-react';
-import {WHITE_HEX} from '../helpers/colors';
import {
areKeyboardShortcutsDisabled,
useKeybinding,
@@ -65,7 +64,9 @@ export const FullScreenToggle: React.FC<{
aria-label={accessibilityLabel}
onClick={onClick}
>
- <FullscreenIcon color={WHITE_HEX} style={{width: 18, height: 18}} />
+ {(color) => (
+ <FullscreenIcon color={color} style={{width: 18, height: 18}} />
+ )}
</ControlButton>
);
};
diff --git a/packages/studio/src/components/InlineAction.tsx b/packages/studio/src/components/InlineAction.tsx
index 212ea310e3..e588d28322 100644
--- a/packages/studio/src/components/InlineAction.tsx
+++ b/packages/studio/src/components/InlineAction.tsx
@@ -9,13 +9,15 @@ import {useZIndex} from '../state/z-index';
export type RenderInlineAction = (color: string) => React.ReactNode;
-export type InlineActionProps = {
+export type InlineActionProps = Omit<
+ React.ButtonHTMLAttributes<HTMLButtonElement>,
+ 'children' | 'onClick' | 'style'
+> & {
readonly onClick: React.MouseEventHandler<HTMLButtonElement>;
- readonly disabled?: boolean;
readonly renderAction: RenderInlineAction;
- readonly title?: string;
readonly unhoveredColor?: string;
readonly variant: 'compact' | null;
+ readonly style?: React.CSSProperties;
};
export const InlineAction = ({
@@ -25,6 +27,8 @@ export const InlineAction = ({
title,
unhoveredColor = LIGHT_TEXT,
variant,
+ style: customStyle,
+ ...buttonProps
}: InlineActionProps) => {
const {tabIndex} = useZIndex();
@@ -53,11 +57,13 @@ export const InlineAction = ({
borderRadius: 3,
opacity: disabled ? 0.5 : 1,
pointerEvents: disabled ? 'none' : 'auto',
+ ...customStyle,
};
- }, [disabled, hovered, variant]);
+ }, [customStyle, disabled, hovered, variant]);
return (
<button
+ {...buttonProps}
type="button"
disabled={disabled}
onPointerEnter={onPointerEnter}
@@ -66,7 +72,7 @@ export const InlineAction = ({
style={style}
tabIndex={tabIndex}
title={title}
- aria-label={title}
+ aria-label={buttonProps['aria-label'] ?? title}
>
{renderAction(hovered ? WHITE : unhoveredColor)}
</button>
diff --git a/packages/studio/src/components/LoopToggle.tsx b/packages/studio/src/components/LoopToggle.tsx
index 3d15a56a9b..3a8c94bbe0 100644
--- a/packages/studio/src/components/LoopToggle.tsx
+++ b/packages/studio/src/components/LoopToggle.tsx
@@ -1,5 +1,5 @@
import React, {useCallback} from 'react';
-import {BLUE, WHITE} from '../helpers/colors';
+import {BLUE} from '../helpers/colors';
import {persistLoopOption} from '../state/loop';
import {ControlButton} from './ControlButton';
@@ -28,12 +28,14 @@ export const LoopToggle: React.FC<{
aria-label={accessibilityLabel}
onClick={onClick}
>
- <svg viewBox="0 0 512 512" style={{width: 18, height: 18}}>
- <path
- fill={loop ? BLUE : WHITE}
- d="M384 150.3V41.6l64 53.3v2l-64 53.3zM352 23.5V80H192C86 80 0 166 0 272c0 8.8 7.2 16 16 16s16-7.2 16-16c0-88.4 71.6-160 160-160h160v56.5c0 13 10.5 23.5 23.5 23.5 5.5 0 10.8-1.9 15-5.4l78-65c7.3-6.1 11.5-15.1 11.5-24.6v-2c0-9.5-4.2-18.5-11.5-24.6l-78-65c-4.2-3.5-9.5-5.4-15-5.4-13 0-23.5 10.5-23.5 23.5zM128 415.9v54.5l-64-53.3v-2l64-53.3v54.1zM160 400v-56.5c0-13-10.5-23.5-23.5-23.5-5.5 0-10.8 1.9-15 5.4l-78 65C36.2 396.5 32 405.5 32 415v2c0 9.5 4.2 18.5 11.5 24.6l78 65c4.2 3.5 9.5 5.4 15 5.4 13 0 23.5-10.5 23.5-23.5V432h160c106 0 192-86 192-192 0-8.8-7.2-16-16-16s-16 7.2-16 16c0 88.4-71.6 160-160 160H160z"
- />
- </svg>
+ {(color) => (
+ <svg viewBox="0 0 512 512" style={{width: 18, height: 18}}>
+ <path
+ fill={loop ? BLUE : color}
+ d="M384 150.3V41.6l64 53.3v2l-64 53.3zM352 23.5V80H192C86 80 0 166 0 272c0 8.8 7.2 16 16 16s16-7.2 16-16c0-88.4 71.6-160 160-160h160v56.5c0 13 10.5 23.5 23.5 23.5 5.5 0 10.8-1.9 15-5.4l78-65c7.3-6.1 11.5-15.1 11.5-24.6v-2c0-9.5-4.2-18.5-11.5-24.6l-78-65c-4.2-3.5-9.5-5.4-15-5.4-13 0-23.5 10.5-23.5 23.5zM128 415.9v54.5l-64-53.3v-2l64-53.3v54.1zM160 400v-56.5c0-13-10.5-23.5-23.5-23.5-5.5 0-10.8 1.9-15 5.4l-78 65C36.2 396.5 32 405.5 32 415v2c0 9.5 4.2 18.5 11.5 24.6l78 65c4.2 3.5 9.5 5.4 15 5.4 13 0 23.5-10.5 23.5-23.5V432h160c106 0 192-86 192-192 0-8.8-7.2-16-16-16s-16 7.2-16 16c0 88.4-71.6 160-160 160H160z"
+ />
+ </svg>
+ )}
</ControlButton>
);
};
diff --git a/packages/studio/src/components/MenuBuildIndicator.tsx b/packages/studio/src/components/MenuBuildIndicator.tsx
index 765fecc628..0cb7a3c19d 100644
--- a/packages/studio/src/components/MenuBuildIndicator.tsx
+++ b/packages/studio/src/components/MenuBuildIndicator.tsx
@@ -7,6 +7,7 @@ import React, {
useState,
} from 'react';
import {StudioServerConnectionCtx} from '../helpers/client-id';
+import {WHITE_ALPHA_80} from '../helpers/colors';
import {
getGitSourceBranchUrl,
getGitSourceName,
@@ -135,7 +136,7 @@ export const MenuBuildIndicator: React.FC<{
{isClickable ? <Spacing x={mobileLayout ? 0.5 : 2} /> : null}
{mobileLayout ? null : isBuilding ? (
<div style={spinner}>
- <Spinner duration={0.5} size={spinnerSize} />
+ <Spinner duration={0.5} size={spinnerSize} color={WHITE_ALPHA_80} />
</div>
) : (
<div style={noSpinner} />
@@ -159,7 +160,7 @@ export const MenuBuildIndicator: React.FC<{
<>
<Spacing x={0.5} />
<div style={spinner}>
- <Spinner duration={0.5} size={spinnerSize} />
+ <Spinner duration={0.5} size={spinnerSize} color={WHITE_ALPHA_80} />
</div>
</>
) : null}
diff --git a/packages/studio/src/components/MuteToggle.tsx b/packages/studio/src/components/MuteToggle.tsx
index 6a1fde748c..56e906ce32 100644
--- a/packages/studio/src/components/MuteToggle.tsx
+++ b/packages/studio/src/components/MuteToggle.tsx
@@ -1,4 +1,5 @@
import {useCallback} from 'react';
+import {BLUE} from '../helpers/colors';
import {VolumeOffIcon, VolumeOnIcon} from '../icons/media-volume';
import {persistMuteOption} from '../state/mute';
import {ControlButton} from './ControlButton';
@@ -21,7 +22,9 @@ export const MuteToggle: React.FC<{
aria-label={accessibilityLabel}
onClick={onClick}
>
- {muted ? <VolumeOffIcon /> : <VolumeOnIcon />}
+ {(color) =>
+ muted ? <VolumeOffIcon color={BLUE} /> : <VolumeOnIcon color={color} />
+ }
</ControlButton>
);
};
diff --git a/packages/studio/src/components/NewComposition/ComboBox.tsx b/packages/studio/src/components/NewComposition/ComboBox.tsx
index b023eb2e8e..e0a0639808 100644
--- a/packages/studio/src/components/NewComposition/ComboBox.tsx
+++ b/packages/studio/src/components/NewComposition/ComboBox.tsx
@@ -3,6 +3,7 @@ import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import ReactDOM from 'react-dom';
import {
INPUT_BACKGROUND,
+ LIGHT_TEXT,
WHITE_ALPHA_05,
BLACK_ALPHA_60,
SELECTED_BACKGROUND,
@@ -108,12 +109,14 @@ export const Combobox: React.FC<{
readonly style?: React.CSSProperties;
readonly title: string;
readonly size?: ComboboxSize;
+ readonly unhoveredIconColor?: string;
}> = ({
values,
selectedId,
style: customStyle,
title,
size: controlSize = 'default',
+ unhoveredIconColor = LIGHT_TEXT,
}) => {
const [hovered, setIsHovered] = useState(false);
const [opened, setOpened] = useState(false);
@@ -316,7 +319,10 @@ export const Combobox: React.FC<{
</div>
) : null}
<Spacing x={controlSize === 'default' ? 1 : 0.5} />{' '}
- <CaretDown small={controlSize === 'small'} />
+ <CaretDown
+ color={hovered || opened ? WHITE : unhoveredIconColor}
+ small={controlSize === 'small'}
+ />
</button>
{portalStyle
? ReactDOM.createPortal(
diff --git a/packages/studio/src/components/NewComposition/InputDragger.tsx b/packages/studio/src/components/NewComposition/InputDragger.tsx
index 8b7cbcdf7b..9d2a236bac 100644
--- a/packages/studio/src/components/NewComposition/InputDragger.tsx
+++ b/packages/studio/src/components/NewComposition/InputDragger.tsx
@@ -23,6 +23,10 @@ type Props = InputHTMLAttributes<HTMLInputElement> & {
readonly onTextChange: (newVal: string) => void;
readonly status: RemInputStatus;
readonly formatter?: (str: number | string) => string;
+ readonly formatterStyle?: React.CSSProperties;
+ readonly formatterSubtitle?: (str: number | string) => string;
+ readonly formatterSubtitleStyle?: React.CSSProperties;
+ readonly buttonStyle?: React.CSSProperties;
readonly rightAlign: boolean;
readonly small?: boolean;
readonly snapToStep?: boolean;
@@ -439,6 +443,10 @@ const InputDraggerForwardRefFn: React.ForwardRefRenderFunction<
value,
onTextChange,
formatter = (q) => String(q),
+ formatterStyle,
+ formatterSubtitle,
+ formatterSubtitleStyle,
+ buttonStyle,
status,
rightAlign,
small,
@@ -470,8 +478,9 @@ const InputDraggerForwardRefFn: React.ForwardRefRenderFunction<
WebkitUserSelect: 'none',
fontSize: small ? 12 : 14,
fontVariantNumeric: 'tabular-nums',
+ ...formatterStyle,
}),
- [dragging, small],
+ [dragging, formatterStyle, small],
);
const onFocus = useCallback(() => {
@@ -711,14 +720,24 @@ const InputDraggerForwardRefFn: React.ForwardRefRenderFunction<
<button
ref={ref}
type="button"
+ aria-label={props['aria-label']}
className={'__remotion_input_dragger'}
- style={inputDraggerContainerStyle}
+ style={
+ buttonStyle
+ ? {...inputDraggerContainerStyle, ...buttonStyle}
+ : inputDraggerContainerStyle
+ }
onClick={onClick}
onFocus={onFocus}
onKeyDown={onKeyDown}
onPointerDown={onPointerDown}
>
<span style={span}>{formatter(value as string | number)}</span>
+ {formatterSubtitle ? (
+ <span style={formatterSubtitleStyle}>
+ {formatterSubtitle(value as string | number)}
+ </span>
+ ) : null}
</button>
);
};
diff --git a/packages/studio/src/components/OutlineToggle.tsx b/packages/studio/src/components/OutlineToggle.tsx
index 5dc70d9722..b7cb0dc6af 100644
--- a/packages/studio/src/components/OutlineToggle.tsx
+++ b/packages/studio/src/components/OutlineToggle.tsx
@@ -1,5 +1,5 @@
import React, {useCallback, useContext} from 'react';
-import {BACKGROUND_HEX, BLUE, WHITE} from '../helpers/colors';
+import {BACKGROUND_HEX, BLUE} from '../helpers/colors';
import {EditorShowOutlinesContext} from '../state/editor-outlines';
import {ControlButton} from './ControlButton';
@@ -12,7 +12,6 @@ export const OutlineToggle: React.FC = () => {
setEditorShowOutlines((current) => !current);
}, [setEditorShowOutlines]);
- const color = editorShowOutlines ? BLUE : WHITE;
const accessibilityLabel = editorShowOutlines
? 'Hide outlines'
: 'Show outlines';
@@ -23,33 +22,42 @@ export const OutlineToggle: React.FC = () => {
aria-label={accessibilityLabel}
onClick={onClick}
>
- <svg
- style={{width: 17, height: 17}}
- viewBox="0 0 512 512"
- fill="none"
- aria-hidden="true"
- focusable="false"
- >
- <path d="M64 64H448V448H64V64Z" stroke={color} strokeWidth="36" />
- {[
- [16, 16],
- [400, 16],
- [16, 400],
- [400, 400],
- ].map(([x, y]) => (
- <rect
- key={`${x}-${y}`}
- x={x}
- y={y}
- width="96"
- height="96"
- rx="24"
- fill={BACKGROUND_HEX}
- stroke={color}
- strokeWidth="32"
- />
- ))}
- </svg>
+ {(color) => {
+ const iconColor = editorShowOutlines ? BLUE : color;
+ return (
+ <svg
+ style={{width: 17, height: 17}}
+ viewBox="0 0 512 512"
+ fill="none"
+ aria-hidden="true"
+ focusable="false"
+ >
+ <path
+ d="M64 64H448V448H64V64Z"
+ stroke={iconColor}
+ strokeWidth="36"
+ />
+ {[
+ [16, 16],
+ [400, 16],
+ [16, 400],
+ [400, 400],
+ ].map(([x, y]) => (
+ <rect
+ key={`${x}-${y}`}
+ x={x}
+ y={y}
+ width="96"
+ height="96"
+ rx="24"
+ fill={BACKGROUND_HEX}
+ stroke={iconColor}
+ strokeWidth="32"
+ />
+ ))}
+ </svg>
+ );
+ }}
</ControlButton>
);
};
diff --git a/packages/studio/src/components/PlayPause.tsx b/packages/studio/src/components/PlayPause.tsx
index 9b7be477b0..796bc514c6 100644
--- a/packages/studio/src/components/PlayPause.tsx
+++ b/packages/studio/src/components/PlayPause.tsx
@@ -1,7 +1,6 @@
import {PlayerInternals} from '@remotion/player';
import React, {useCallback, useEffect, useState} from 'react';
import {Internals} from 'remotion';
-import {WHITE} from '../helpers/colors';
import {useIsStill} from '../helpers/is-current-selected-still';
import {useKeybinding} from '../helpers/use-keybinding';
import {JumpToStart} from '../icons/jump-to-start';
@@ -16,18 +15,15 @@ import {ensureFrameIsInViewport} from './Timeline/timeline-scroll-logic';
const backStyle = {
height: 18,
- color: WHITE,
};
const forwardBackStyle = {
height: 16,
- color: WHITE,
};
const iconButton: React.CSSProperties = {
height: 14,
width: 14,
- color: WHITE,
};
export const PlayPause: React.FC<{
@@ -259,7 +255,7 @@ export const PlayPause: React.FC<{
disabled={!videoConfig || isFirstFrame}
onClick={jumpToStart}
>
- <JumpToStart style={backStyle} />
+ {(color) => <JumpToStart style={backStyle} color={color} />}
</ControlButton>
)}
{hideNavigationControls ? null : (
@@ -269,7 +265,7 @@ export const PlayPause: React.FC<{
disabled={!videoConfig || isFirstFrame}
onClick={oneFrameBack}
>
- <StepBack style={forwardBackStyle} />
+ {(color) => <StepBack style={forwardBackStyle} color={color} />}
</ControlButton>
)}
@@ -279,15 +275,17 @@ export const PlayPause: React.FC<{
onClick={playing ? pause : play}
disabled={!videoConfig}
>
- {playing ? (
- showBufferIndicator ? (
- <PlayerInternals.BufferingIndicator type="studio" />
+ {(color) =>
+ playing ? (
+ showBufferIndicator ? (
+ <PlayerInternals.BufferingIndicator type="studio" color={color} />
+ ) : (
+ <Pause style={iconButton} color={color} />
+ )
) : (
- <Pause style={iconButton} />
+ <Play style={iconButton} color={color} />
)
- ) : (
- <Play style={iconButton} />
- )}
+ }
</ControlButton>
{hideNavigationControls ? null : (
@@ -297,7 +295,7 @@ export const PlayPause: React.FC<{
disabled={!videoConfig || isLastFrame}
onClick={oneFrameForward}
>
- <StepForward style={forwardBackStyle} />
+ {(color) => <StepForward style={forwardBackStyle} color={color} />}
</ControlButton>
)}
</>
diff --git a/packages/studio/src/components/PlaybackRateSelector.tsx b/packages/studio/src/components/PlaybackRateSelector.tsx
index d946bb5504..d02bb53fd3 100644
--- a/packages/studio/src/components/PlaybackRateSelector.tsx
+++ b/packages/studio/src/components/PlaybackRateSelector.tsx
@@ -1,5 +1,6 @@
import React, {useContext, useMemo} from 'react';
import {Internals} from 'remotion';
+import {WHITE_ALPHA_80} from '../helpers/colors';
import {useIsStill} from '../helpers/is-current-selected-still';
import {Checkmark} from '../icons/Checkmark';
import {persistPlaybackRate} from '../state/playbackrate';
@@ -92,6 +93,7 @@ export const PlaybackRateSelector: React.FC<PlaybackRateMenuItemsProps> = ({
style={comboStyle}
selectedId={selectedId}
values={items}
+ unhoveredIconColor={WHITE_ALPHA_80}
/>
</div>
);
diff --git a/packages/studio/src/components/PreviewToolbar.tsx b/packages/studio/src/components/PreviewToolbar.tsx
index 81c5b61a3b..5a270fde01 100644
--- a/packages/studio/src/components/PreviewToolbar.tsx
+++ b/packages/studio/src/components/PreviewToolbar.tsx
@@ -24,7 +24,6 @@ import {PreviewToolbarOverflowButton} from './PreviewToolbarOverflowButton';
import {RenderButton} from './RenderButton';
import {SizeSelector} from './SizeSelector';
import {SnappingToggle} from './SnappingToggle';
-import {TimelineZoomControls} from './Timeline/TimelineZoomControls';
import {TimelineInOutPointToggle} from './TimelineInOutToggle';
const TOOLBAR_HEIGHT = 40;
@@ -115,28 +114,27 @@ export const PreviewToolbar: React.FC<{
<div style={sideContainer}>
<div style={padding} />
{isMobileLayout ? (
- <PreviewToolbarControl>
- <PreviewToolbarOverflowButton
- readOnlyStudio={readOnlyStudio}
- showFullscreen={Boolean(canvasContent && isFullscreenSupported)}
- showPlaybackRate={isVideoComposition}
- showLoop={isVideoComposition}
- showCompositionControls={canvasContent?.type === 'composition'}
- playbackRate={playbackRate}
- setPlaybackRate={setPlaybackRate}
- loop={loop}
- setLoop={setLoop}
- />
- </PreviewToolbarControl>
+ <>
+ <PreviewToolbarControl>
+ <PreviewToolbarOverflowButton
+ showFullscreen={Boolean(canvasContent && isFullscreenSupported)}
+ showPlaybackRate={isVideoComposition}
+ showLoop={isVideoComposition}
+ showCompositionControls={canvasContent?.type === 'composition'}
+ playbackRate={playbackRate}
+ setPlaybackRate={setPlaybackRate}
+ loop={loop}
+ setLoop={setLoop}
+ />
+ </PreviewToolbarControl>
+ <Spacing x={1.5} />
+ </>
) : null}
{isVideoComposition && isMobileLayout ? (
<PreviewToolbarControl>
<MuteToggle muted={playerMuted} setMuted={setPlayerMuted} />
</PreviewToolbarControl>
) : null}
- <PreviewToolbarControl>
- <TimelineZoomControls />
- </PreviewToolbarControl>
</div>
<Flex />
{isMobileLayout ? null : (
@@ -164,6 +162,7 @@ export const PreviewToolbar: React.FC<{
<PreviewToolbarControl>
<LoopToggle loop={loop} setLoop={setLoop} />
</PreviewToolbarControl>
+ <Spacing x={0.75} />
<PreviewToolbarControl>
<MuteToggle muted={playerMuted} setMuted={setPlayerMuted} />
</PreviewToolbarControl>
@@ -181,15 +180,19 @@ export const PreviewToolbar: React.FC<{
<CheckboardToggle />
</PreviewToolbarControl>
)}
+ {isMobileLayout ? null : <Spacing x={0.25} />}
{isMobileLayout ? null : (
<PreviewToolbarControl>
<OutlineToggle />
</PreviewToolbarControl>
)}
{readOnlyStudio || isMobileLayout ? null : (
- <PreviewToolbarControl>
- <SnappingToggle />
- </PreviewToolbarControl>
+ <>
+ <Spacing x={0.25} />
+ <PreviewToolbarControl>
+ <SnappingToggle />
+ </PreviewToolbarControl>
+ </>
)}
</>
) : null}
diff --git a/packages/studio/src/components/PreviewToolbarOverflowButton.tsx b/packages/studio/src/components/PreviewToolbarOverflowButton.tsx
index 59112e6abf..2fbf28a22d 100644
--- a/packages/studio/src/components/PreviewToolbarOverflowButton.tsx
+++ b/packages/studio/src/components/PreviewToolbarOverflowButton.tsx
@@ -1,7 +1,6 @@
import type {SVGProps} from 'react';
import React, {useCallback, useContext, useMemo} from 'react';
-import {Internals} from 'remotion';
-import {WHITE} from '../helpers/colors';
+import {WHITE_ALPHA_80} from '../helpers/colors';
import {areKeyboardShortcutsDisabled} from '../helpers/use-keybinding';
import {Checkmark} from '../icons/Checkmark';
import {EllipsisIcon} from '../icons/ellipsis';
@@ -19,7 +18,6 @@ const clickButton = (id: string) => {
};
export const PreviewToolbarOverflowButton: React.FC<{
- readonly readOnlyStudio: boolean;
readonly showFullscreen: boolean;
readonly showPlaybackRate: boolean;
readonly showLoop: boolean;
@@ -29,7 +27,6 @@ export const PreviewToolbarOverflowButton: React.FC<{
readonly loop: boolean;
readonly setLoop: React.Dispatch<React.SetStateAction<boolean>>;
}> = ({
- readOnlyStudio,
showFullscreen,
showPlaybackRate,
showLoop,
@@ -39,7 +36,6 @@ export const PreviewToolbarOverflowButton: React.FC<{
loop,
setLoop,
}) => {
- const video = Internals.useVideo();
const {checkerboard, setCheckerboard} = useContext(CheckerboardContext);
const {editorShowOutlines, setEditorShowOutlines} = useContext(
EditorShowOutlinesContext,
@@ -67,60 +63,6 @@ export const PreviewToolbarOverflowButton: React.FC<{
[iconStyle],
);
- const renderItems = useMemo((): ComboboxValue[] => {
- if (readOnlyStudio) {
- return [
- {
- type: 'item',
- id: 'client-render',
- label: 'Render on web',
- value: 'client-render',
- onClick: () => clickButton('render-modal-button-client'),
- keyHint: null,
- leftItem: null,
- subMenu: null,
- quickSwitcherLabel: null,
- },
- {
- type: 'item',
- id: 'render-command',
- label: 'Render via CLI',
- value: 'render-command',
- onClick: () => clickButton('render-modal-button-command'),
- keyHint: null,
- leftItem: null,
- subMenu: null,
- quickSwitcherLabel: null,
- },
- ];
- }
-
- return [
- {
- type: 'item',
- id: 'server-render',
- label: 'Server-side render',
- value: 'server-render',
- onClick: () => clickButton('render-modal-button-server'),
- keyHint: null,
- leftItem: null,
- subMenu: null,
- quickSwitcherLabel: null,
- },
- {
- type: 'item',
- id: 'client-render',
- label: 'Client-side render',
- value: 'client-render',
- onClick: () => clickButton('render-modal-button-client'),
- keyHint: null,
- leftItem: null,
- subMenu: null,
- quickSwitcherLabel: null,
- },
- ];
- }, [readOnlyStudio]);
-
const values = useMemo((): ComboboxValue[] => {
const items: ComboboxValue[] = [];
@@ -217,29 +159,10 @@ export const PreviewToolbarOverflowButton: React.FC<{
});
}
- if (video) {
- items.push({
- type: 'item',
- id: 'render',
- label: 'Render',
- value: 'render',
- onClick: () => undefined,
- keyHint: null,
- leftItem: null,
- subMenu: {
- items: renderItems,
- leaveLeftSpace: false,
- preselectIndex: 0,
- },
- quickSwitcherLabel: null,
- });
- }
-
return items;
}, [
previewSizeItems,
playbackRateItems,
- renderItems,
selectedPlaybackRate,
selectedPreviewSize,
showFullscreen,
@@ -252,7 +175,6 @@ export const PreviewToolbarOverflowButton: React.FC<{
setCheckerboard,
setEditorShowOutlines,
setLoop,
- video,
zoomable,
]);
@@ -266,7 +188,7 @@ export const PreviewToolbarOverflowButton: React.FC<{
renderAction={renderAction}
values={values}
title="More actions"
- unhoveredColor={WHITE}
+ unhoveredColor={WHITE_ALPHA_80}
/>
);
};
diff --git a/packages/studio/src/components/RenderButton.tsx b/packages/studio/src/components/RenderButton.tsx
index 1df503785d..31ecd417bb 100644
--- a/packages/studio/src/components/RenderButton.tsx
+++ b/packages/studio/src/components/RenderButton.tsx
@@ -16,11 +16,10 @@ import {Internals} from 'remotion';
import {StudioServerConnectionCtx} from '../helpers/client-id';
import {
BLACK_ALPHA_60,
- CURRENT_COLOR,
- CURRENT_COLOR_LOWERCASE,
INPUT_BACKGROUND,
TRANSPARENT,
WHITE,
+ WHITE_ALPHA_80,
} from '../helpers/colors';
import {areKeyboardShortcutsDisabled} from '../helpers/use-keybinding';
import {CaretDown} from '../icons/caret';
@@ -167,6 +166,8 @@ export const RenderButton: React.FC<{
() => getInitialRenderType(readOnlyStudio),
);
const [dropdownOpened, setDropdownOpened] = useState(false);
+ const [mainButtonHovered, setMainButtonHovered] = useState(false);
+ const [dropdownButtonHovered, setDropdownButtonHovered] = useState(false);
const dropdownRef = useRef<HTMLButtonElement>(null);
const containerRef = useRef<HTMLDivElement>(null);
const {currentZIndex} = useZIndex();
@@ -260,7 +261,6 @@ export const RenderButton: React.FC<{
return {
style: {
height: controlSize === 'compact' ? 14 : 16,
- color: CURRENT_COLOR,
flexShrink: 0,
},
};
@@ -532,6 +532,9 @@ export const RenderButton: React.FC<{
: renderType === 'render-command'
? 'Render via CLI'
: 'Render on web';
+ const mainIconColor = mainButtonHovered ? WHITE : WHITE_ALPHA_80;
+ const dropdownIconColor =
+ dropdownOpened || dropdownButtonHovered ? WHITE : WHITE_ALPHA_80;
if (!video) {
return null;
@@ -565,6 +568,8 @@ export const RenderButton: React.FC<{
controlSize === 'compact' ? compactMainButtonStyle : mainButtonStyle
}
onClick={onClick}
+ onPointerEnter={() => setMainButtonHovered(true)}
+ onPointerLeave={() => setMainButtonHovered(false)}
id="render-modal-button"
>
<Row
@@ -575,10 +580,7 @@ export const RenderButton: React.FC<{
: mainButtonContent
}
>
- <ThinRenderIcon
- fill={CURRENT_COLOR_LOWERCASE}
- svgProps={iconStyle}
- />
+ <ThinRenderIcon fill={mainIconColor} svgProps={iconStyle} />
<Spacing x={controlSize === 'compact' ? 0.75 : 1} />
<span style={controlSize === 'compact' ? compactLabel : label}>
{renderLabel}
@@ -597,8 +599,10 @@ export const RenderButton: React.FC<{
className={MENU_INITIATOR_CLASSNAME}
onPointerDown={onPointerDown}
onClick={onClickDropdown}
+ onPointerEnter={() => setDropdownButtonHovered(true)}
+ onPointerLeave={() => setDropdownButtonHovered(false)}
>
- <CaretDown />
+ <CaretDown color={dropdownIconColor} />
</button>
</div>
{portalStyle
diff --git a/packages/studio/src/components/SizeSelector.tsx b/packages/studio/src/components/SizeSelector.tsx
index 97f36190ec..98adc3051f 100644
--- a/packages/studio/src/components/SizeSelector.tsx
+++ b/packages/studio/src/components/SizeSelector.tsx
@@ -1,6 +1,7 @@
import React, {useContext, useMemo} from 'react';
import type {PreviewSize} from 'remotion';
import {Internals} from 'remotion';
+import {WHITE_ALPHA_80} from '../helpers/colors';
import type {AssetFileType} from '../helpers/get-preview-file-type';
import {getPreviewFileType} from '../helpers/get-preview-file-type';
import {Checkmark} from '../icons/Checkmark';
@@ -154,6 +155,7 @@ export const SizeSelector: React.FC = () => {
style={comboStyle}
selectedId={selectedId}
values={items}
+ unhoveredIconColor={WHITE_ALPHA_80}
/>
</div>
);
diff --git a/packages/studio/src/components/SnappingToggle.tsx b/packages/studio/src/components/SnappingToggle.tsx
index 0b4c783115..698f675d30 100644
--- a/packages/studio/src/components/SnappingToggle.tsx
+++ b/packages/studio/src/components/SnappingToggle.tsx
@@ -1,6 +1,6 @@
import React, {useCallback, useContext} from 'react';
import {NoReactInternals} from 'remotion/no-react';
-import {BLUE, WHITE} from '../helpers/colors';
+import {BLUE} from '../helpers/colors';
import {areKeyboardShortcutsDisabled} from '../helpers/use-keybinding';
import {MagnetIcon} from '../icons/magnet';
import {EditorSnappingContext} from '../state/editor-snapping';
@@ -13,7 +13,6 @@ export const SnappingToggle: React.FC = () => {
setEditorSnapping((current) => !current);
}, [setEditorSnapping]);
- const color = editorSnapping ? BLUE : WHITE;
const accessibilityLabel = [
editorSnapping ? 'Disable snapping' : 'Enable snapping',
areKeyboardShortcutsDisabled() ? null : '(Shift+M)',
@@ -29,12 +28,14 @@ export const SnappingToggle: React.FC = () => {
aria-keyshortcuts="Shift+M"
onClick={onClick}
>
- <MagnetIcon
- style={{width: 17, height: 17, transform: 'translateY(1px)'}}
- fill={color}
- aria-hidden="true"
- focusable="false"
- />
+ {(color) => (
+ <MagnetIcon
+ style={{width: 18, height: 18, transform: 'translateY(1px)'}}
+ color={editorSnapping ? BLUE : color}
+ aria-hidden="true"
+ focusable="false"
+ />
+ )}
</ControlButton>
);
};
diff --git a/packages/studio/src/components/Spinner.tsx b/packages/studio/src/components/Spinner.tsx
index 8d5379ae0f..0be8203d8a 100644
--- a/packages/studio/src/components/Spinner.tsx
+++ b/packages/studio/src/components/Spinner.tsx
@@ -13,7 +13,8 @@ const translated =
export const Spinner: React.FC<{
readonly size: number;
readonly duration: number;
-}> = ({size, duration}) => {
+ readonly color?: string;
+}> = ({size, duration, color = LIGHT_TEXT}) => {
const style = useMemo(() => {
return {
width: size,
@@ -50,7 +51,7 @@ export const Spinner: React.FC<{
animationDelay: `${index * (duration / lines) - duration}s`,
}}
d={translated}
- fill={LIGHT_TEXT}
+ fill={color}
/>
);
})}
diff --git a/packages/studio/src/components/TimeValue.tsx b/packages/studio/src/components/TimeValue.tsx
index eff8458949..627ea5c0b8 100644
--- a/packages/studio/src/components/TimeValue.tsx
+++ b/packages/studio/src/components/TimeValue.tsx
@@ -12,6 +12,7 @@ import {useKeybinding} from '../helpers/use-keybinding';
import {renderFrame} from '../state/render-frame';
import {Flex, Spacing} from './layout';
import {InputDragger} from './NewComposition/InputDragger';
+import {TimelineZoomControls} from './Timeline/TimelineZoomControls';
const text: React.CSSProperties = {
color: WHITE,
@@ -23,20 +24,35 @@ const text: React.CSSProperties = {
width: '100%',
};
-const time: React.CSSProperties = {
+const currentTimeTypography: React.CSSProperties = {
+ color: WHITE,
display: 'inline-block',
- fontSize: 16,
+ fontSize: 14,
+ fontVariantNumeric: 'tabular-nums',
+ fontWeight: 400,
lineHeight: 1,
fontFamily: 'monospace',
};
-const frameStyle: React.CSSProperties = {
+const currentTimeInputStyle: React.CSSProperties = {
+ ...currentTimeTypography,
+ padding: '4px 6px 4px 0',
+};
+
+const currentTimeButtonStyle: React.CSSProperties = {
+ paddingLeft: 0,
+ transform: 'translateY(-1px)',
+};
+
+const currentTimeSubtitle: React.CSSProperties = {
color: LIGHT_TEXT,
- fontWeight: 500,
- lineHeight: 1,
- fontSize: 16,
+ display: 'block',
fontFamily: 'monospace',
- paddingRight: 10,
+ fontSize: 10,
+ fontWeight: 400,
+ lineHeight: 1,
+ marginTop: -2,
+ textAlign: 'left',
};
export const TimeValue: React.FC = () => {
@@ -59,6 +75,16 @@ export const TimeValue: React.FC = () => {
},
[seek],
);
+ const formatter = useCallback(
+ (value: string | number) => {
+ return config ? renderFrame(Number(value), config.fps) : String(value);
+ },
+ [config],
+ );
+ const formatterSubtitle = useCallback(
+ (value: string | number) => String(value),
+ [],
+ );
useImperativeHandle(
Internals.timeValueRef,
() => ({
@@ -101,18 +127,25 @@ export const TimeValue: React.FC = () => {
return (
<div style={text}>
- <div style={time}>{renderFrame(frame, config.fps)}</div>
- <Spacing x={2} />
- <Flex />
<InputDragger
ref={ref}
+ aria-label={String(frame)}
value={frame}
onTextChange={onTextChange}
onValueChange={onValueChange}
- rightAlign
+ formatter={formatter}
+ formatterStyle={currentTimeTypography}
+ formatterSubtitle={formatterSubtitle}
+ formatterSubtitleStyle={currentTimeSubtitle}
+ buttonStyle={currentTimeButtonStyle}
+ rightAlign={false}
status="ok"
- style={frameStyle}
+ style={currentTimeInputStyle}
/>
+ <Spacing x={2} />
+ <Flex />
+ <TimelineZoomControls sliderMaxWidth={80} />
+ <Spacing x={0.5} />
</div>
);
};
diff --git a/packages/studio/src/components/Timeline/TimelineZoomControls.tsx b/packages/studio/src/components/Timeline/TimelineZoomControls.tsx
index 11b7cede08..53524470a4 100644
--- a/packages/studio/src/components/Timeline/TimelineZoomControls.tsx
+++ b/packages/studio/src/components/Timeline/TimelineZoomControls.tsx
@@ -1,6 +1,6 @@
import React, {useCallback, useContext} from 'react';
import {Internals} from 'remotion';
-import {BLACK, CURRENT_COLOR_LOWERCASE, WHITE} from '../../helpers/colors';
+import {BLACK} from '../../helpers/colors';
import {useIsStill} from '../../helpers/is-current-selected-still';
import {Minus} from '../../icons/minus';
import {Plus} from '../../icons/plus';
@@ -25,14 +25,63 @@ const buttonStyle: React.CSSProperties = {
};
const iconStyle: React.CSSProperties = {
- color: WHITE,
width: 14,
};
-export const TimelineZoomControls: React.FC = () => {
+const TimelineZoomSlider: React.FC<{
+ readonly maxWidth?: number;
+}> = ({maxWidth}) => {
const {canvasContent} = useContext(Internals.CompositionManager);
const {setZoom, zoom: zoomMap} = useContext(TimelineZoomCtx);
const {tabIndex} = useZIndex();
+ const isStill = useIsStill();
+
+ const onChange: React.ChangeEventHandler<HTMLInputElement> = useCallback(
+ (e) => {
+ if (canvasContent === null || canvasContent.type !== 'composition') {
+ return;
+ }
+
+ setZoom(canvasContent.compositionId, () => Number(e.target.value), {
+ anchorFrame: null,
+ anchorContentX: null,
+ });
+ },
+ [canvasContent, setZoom],
+ );
+
+ if (
+ isStill ||
+ canvasContent === null ||
+ canvasContent.type !== 'composition'
+ ) {
+ return null;
+ }
+
+ const zoom = zoomMap[canvasContent.compositionId] ?? TIMELINE_MIN_ZOOM;
+
+ return (
+ <input
+ style={maxWidth === undefined ? undefined : {maxWidth}}
+ title={`Timeline zoom (${zoom}x)`}
+ alt={`Timeline zoom (${zoom}x)`}
+ type="range"
+ min={TIMELINE_MIN_ZOOM}
+ step={0.1}
+ value={zoom}
+ max={TIMELINE_MAX_ZOOM}
+ onChange={onChange}
+ className="__remotion-timeline-slider"
+ tabIndex={tabIndex}
+ />
+ );
+};
+
+export const TimelineZoomControls: React.FC<{
+ readonly sliderMaxWidth?: number;
+}> = ({sliderMaxWidth}) => {
+ const {canvasContent} = useContext(Internals.CompositionManager);
+ const {setZoom, zoom: zoomMap} = useContext(TimelineZoomCtx);
const onMinusClicked = useCallback(() => {
if (canvasContent === null || canvasContent.type !== 'composition') {
@@ -58,20 +107,6 @@ export const TimelineZoomControls: React.FC = () => {
);
}, [canvasContent, setZoom]);
- const onChange: React.ChangeEventHandler<HTMLInputElement> = useCallback(
- (e) => {
- if (canvasContent === null || canvasContent.type !== 'composition') {
- return;
- }
-
- setZoom(canvasContent.compositionId, () => Number(e.target.value), {
- anchorFrame: null,
- anchorContentX: null,
- });
- },
- [canvasContent, setZoom],
- );
-
const isStill = useIsStill();
if (
@@ -94,21 +129,10 @@ export const TimelineZoomControls: React.FC = () => {
type="button"
disabled={TIMELINE_MIN_ZOOM === zoom}
>
- <Minus style={iconStyle} />
+ {(color) => <Minus style={iconStyle} color={color} />}
</ControlButton>
<Spacing x={0.5} />
- <input
- title={`Timeline zoom (${zoom}x)`}
- alt={`Timeline zoom (${zoom}x)`}
- type={'range'}
- min={TIMELINE_MIN_ZOOM}
- step={0.1}
- value={zoom}
- max={TIMELINE_MAX_ZOOM}
- onChange={onChange}
- className="__remotion-timeline-slider"
- tabIndex={tabIndex}
- />
+ <TimelineZoomSlider maxWidth={sliderMaxWidth} />
<Spacing x={0.5} />
<ControlButton
onClick={onPlusClicked}
@@ -118,7 +142,7 @@ export const TimelineZoomControls: React.FC = () => {
type="button"
disabled={TIMELINE_MAX_ZOOM === zoom}
>
- <Plus color={CURRENT_COLOR_LOWERCASE} style={iconStyle} />
+ {(color) => <Plus color={color} style={iconStyle} />}
</ControlButton>
</div>
);
diff --git a/packages/studio/src/components/TimelineInOutToggle.tsx b/packages/studio/src/components/TimelineInOutToggle.tsx
index 675e6567f9..f5bf81c42a 100644
--- a/packages/studio/src/components/TimelineInOutToggle.tsx
+++ b/packages/studio/src/components/TimelineInOutToggle.tsx
@@ -7,7 +7,7 @@ import React, {
} from 'react';
import {Internals} from 'remotion';
import {NoReactInternals} from 'remotion/no-react';
-import {BLUE, WHITE} from '../helpers/colors';
+import {BLUE} from '../helpers/colors';
import {
areKeyboardShortcutsDisabled,
useKeybinding,
@@ -304,10 +304,12 @@ export const TimelineInOutPointToggle: React.FC = () => {
onContextMenu={clearInMark}
disabled={!videoConfig || isFirstFrame}
>
- <TimelineInPointer
- color={inFrame === null ? WHITE : BLUE}
- style={style}
- />
+ {(color) => (
+ <TimelineInPointer
+ color={inFrame === null ? color : BLUE}
+ style={style}
+ />
+ )}
</ControlButton>
<ControlButton
title={getTooltipText('Out', 'O')}
@@ -316,10 +318,12 @@ export const TimelineInOutPointToggle: React.FC = () => {
onContextMenu={clearOutMark}
disabled={!videoConfig || isLastFrame}
>
- <TimelineOutPointer
- color={outFrame === null ? WHITE : BLUE}
- style={style}
- />
+ {(color) => (
+ <TimelineOutPointer
+ color={outFrame === null ? color : BLUE}
+ style={style}
+ />
+ )}
</ControlButton>
</>
);
diff --git a/packages/studio/src/components/UndoRedoButtons.tsx b/packages/studio/src/components/UndoRedoButtons.tsx
index 2d70a1e585..3bdc99a66b 100644
--- a/packages/studio/src/components/UndoRedoButtons.tsx
+++ b/packages/studio/src/components/UndoRedoButtons.tsx
@@ -9,6 +9,7 @@ import React, {
import {cmdOrCtrlCharacter} from '../error-overlay/remotion-overlay/ShortcutHint';
import {getBrowserStudioOperations} from '../helpers/browser-studio-operations';
import {StudioServerConnectionCtx} from '../helpers/client-id';
+import {WHITE_ALPHA_80} from '../helpers/colors';
import {isMac} from '../helpers/is-mac';
import {
areKeyboardShortcutsDisabled,
@@ -158,11 +159,11 @@ export const UndoRedoButtons: React.FC = () => {
: `Redo (${cmdOrCtrlCharacter}+Y)`;
const renderUndo: RenderInlineAction = useCallback((color) => {
- return <UndoIcon style={{...iconStyle, color}} />;
+ return <UndoIcon style={iconStyle} color={color} />;
}, []);
const renderRedo: RenderInlineAction = useCallback((color) => {
- return <RedoIcon style={{...iconStyle, color}} />;
+ return <RedoIcon style={iconStyle} color={color} />;
}, []);
const canUndo = undoFile !== null;
@@ -180,6 +181,7 @@ export const UndoRedoButtons: React.FC = () => {
renderAction={renderUndo}
title={undoTooltip}
disabled={!canUndo}
+ unhoveredColor={WHITE_ALPHA_80}
/>
<InlineAction
variant={null}
@@ -187,6 +189,7 @@ export const UndoRedoButtons: React.FC = () => {
renderAction={renderRedo}
title={redoTooltip}
disabled={!canRedo}
+ unhoveredColor={WHITE_ALPHA_80}
/>
</>
);
diff --git a/packages/studio/src/helpers/inject-css.ts b/packages/studio/src/helpers/inject-css.ts
index 85e4542a29..ef424ae89d 100644
--- a/packages/studio/src/helpers/inject-css.ts
+++ b/packages/studio/src/helpers/inject-css.ts
@@ -151,7 +151,7 @@ const makeDefaultGlobalCSS = () => {
position: relative;
}
- .__remotion_input_dragger:hover span {
+ .__remotion_input_dragger:hover > span:first-child {
color: var(--remotion-cli-internals-blue-hovered) !important;
}
diff --git a/packages/studio/src/icons/jump-to-start.tsx b/packages/studio/src/icons/jump-to-start.tsx
index 9a8ecc5943..3b7fd9ecde 100644
--- a/packages/studio/src/icons/jump-to-start.tsx
+++ b/packages/studio/src/icons/jump-to-start.tsx
@@ -1,11 +1,14 @@
import type {SVGProps} from 'react';
import {CURRENT_COLOR} from '../helpers/colors';
-export const JumpToStart: React.FC<SVGProps<SVGSVGElement>> = (props) => {
+export const JumpToStart: React.FC<SVGProps<SVGSVGElement>> = ({
+ color = CURRENT_COLOR,
+ ...props
+}) => {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" {...props}>
<path
- fill={CURRENT_COLOR}
+ fill={color}
d="M0 415.1V96.03c0-17.67 14.33-31.1 31.1-31.1C49.67 64.03 64 78.36 64 96.03v131.8l171.5-156.5C256.1 54.28 288 68.66 288 96.03v131.9l171.5-156.5C480.1 54.28 512 68.66 512 96.03v319.9c0 27.37-31.88 41.74-52.5 24.62L288 285.2v130.7c0 27.37-31.88 41.74-52.5 24.62L64 285.2v130.7c0 17.67-14.33 31.1-31.1 31.1C14.33 447.1 0 433.6 0 415.1z"
/>
</svg>
diff --git a/packages/studio/src/icons/magnet.tsx b/packages/studio/src/icons/magnet.tsx
index 6e9803d09f..d43572edc2 100644
--- a/packages/studio/src/icons/magnet.tsx
+++ b/packages/studio/src/icons/magnet.tsx
@@ -1,10 +1,13 @@
import type {SVGProps} from 'react';
import React from 'react';
-export const MagnetIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => {
+export const MagnetIcon: React.FC<
+ Omit<SVGProps<SVGSVGElement>, 'color'> & {readonly color: string}
+> = ({color, ...props}) => {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" {...props}>
<path
+ fill={color}
transform="rotate(180 224 256)"
d="M48 64c-8.8 0-16 7.2-16 16l0 80 80 0 0-80c0-8.8-7.2-16-16-16L48 64zM32 288c0 106 86 192 192 192s192-86 192-192l0-96-80 0 0 96c0 61.9-50.1 112-112 112S112 349.9 112 288l0-96-80 0 0 96zM416 160l0-80c0-8.8-7.2-16-16-16l-48 0c-8.8 0-16 7.2-16 16l0 80 80 0zM0 80C0 53.5 21.5 32 48 32l48 0c26.5 0 48 21.5 48 48l0 208c0 44.2 35.8 80 80 80s80-35.8 80-80l0-208c0-26.5 21.5-48 48-48l48 0c26.5 0 48 21.5 48 48l0 208c0 123.7-100.3 224-224 224S0 411.7 0 288L0 80z"
/>
diff --git a/packages/studio/src/icons/media-volume.tsx b/packages/studio/src/icons/media-volume.tsx
index 5d8a87c8db..1c736b63c6 100644
--- a/packages/studio/src/icons/media-volume.tsx
+++ b/packages/studio/src/icons/media-volume.tsx
@@ -1,20 +1,18 @@
-import {BLUE, WHITE_HEX} from '../helpers/colors';
-
const size = 21;
const speakerPath =
'M112 320H48c-8.8 0-16-7.2-16-16v-96c0-8.8 7.2-16 16-16h64c8.5 0 16.6-3.4 22.6-9.4L252.7 64.6c.4-.4.9-.6 1.4-.6 1.1 0 1.9.9 1.9 1.9V446c0 1.1-.9 1.9-1.9 1.9-.5 0-1-.2-1.4-.6L134.6 329.4c-6-6-14.1-9.4-22.6-9.4zm0-160H48c-26.5 0-48 21.5-48 48v96c0 26.5 21.5 48 48 48h64l118.1 118.1c6.4 6.4 15 9.9 24 9.9 18.7 0 33.9-15.2 33.9-33.9V65.9C288 47.2 272.8 32 254.1 32c-9 0-17.6 3.6-24 9.9L112 160zm243.2 22.4c-5.3 7.1-3.9 17.1 3.2 22.4 15.6 11.7 25.6 30.3 25.6 51.2s-10 39.5-25.6 51.2c-7.1 5.3-8.5 15.3-3.2 22.4s15.3 8.5 22.4 3.2C400.9 315.3 416 287.4 416 256s-15.1-59.3-38.4-76.8c-7.1-5.3-17.1-3.9-22.4 3.2zm87-74.5c-6.8-5.6-16.9-4.7-22.5 2.1s-4.7 16.9 2.1 22.5C457.4 161.9 480 206.3 480 256s-22.6 94.1-58.2 123.4c-6.8 5.6-7.8 15.7-2.1 22.5s15.7 7.8 22.5 2.2C484.8 368.9 512 315.6 512 256s-27.2-112.9-69.8-148.1z';
-export const VolumeOffIcon: React.FC = () => {
+export const VolumeOffIcon: React.FC<{readonly color: string}> = ({color}) => {
return (
<svg width={size} height={size} viewBox="0 0 576 512">
<g transform="translate(32 0)">
- <path d={speakerPath} fill={BLUE} />
+ <path d={speakerPath} fill={color} />
</g>
<path
d="M16-16 560 528"
fill="none"
- stroke={BLUE}
+ stroke={color}
strokeLinecap="round"
strokeWidth="32"
/>
@@ -22,11 +20,11 @@ export const VolumeOffIcon: React.FC = () => {
);
};
-export const VolumeOnIcon: React.FC = () => {
+export const VolumeOnIcon: React.FC<{readonly color: string}> = ({color}) => {
return (
<svg width={size} height={size} viewBox="0 0 576 512">
<g transform="translate(32 0)">
- <path d={speakerPath} fill={WHITE_HEX} />
+ <path d={speakerPath} fill={color} />
</g>
</svg>
);
diff --git a/packages/studio/src/icons/minus.tsx b/packages/studio/src/icons/minus.tsx
index 79831e3480..590c1bd572 100644
--- a/packages/studio/src/icons/minus.tsx
+++ b/packages/studio/src/icons/minus.tsx
@@ -2,11 +2,13 @@ import type {SVGProps} from 'react';
import React from 'react';
import {CURRENT_COLOR} from '../helpers/colors';
-export const Minus: React.FC<SVGProps<SVGSVGElement>> = (props) => {
+export const Minus: React.FC<
+ SVGProps<SVGSVGElement> & {readonly color?: string}
+> = ({color = CURRENT_COLOR, ...props}) => {
return (
<svg {...props} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<path
- fill={CURRENT_COLOR}
+ fill={color}
d="M0 256c0-8.8 7.2-16 16-16l416 0c8.8 0 16 7.2 16 16s-7.2 16-16 16L16 272c-8.8 0-16-7.2-16-16z"
/>
</svg>
diff --git a/packages/studio/src/icons/pause.tsx b/packages/studio/src/icons/pause.tsx
index 1a4c8b3df9..1eca35d3ff 100644
--- a/packages/studio/src/icons/pause.tsx
+++ b/packages/studio/src/icons/pause.tsx
@@ -2,7 +2,10 @@ import type {SVGProps} from 'react';
import React from 'react';
import {CURRENT_COLOR} from '../helpers/colors';
-export const Pause: React.FC<SVGProps<SVGSVGElement>> = (props) => (
+export const Pause: React.FC<SVGProps<SVGSVGElement>> = ({
+ color = CURRENT_COLOR,
+ ...props
+}) => (
<svg
{...props}
aria-hidden="true"
@@ -15,7 +18,7 @@ export const Pause: React.FC<SVGProps<SVGSVGElement>> = (props) => (
viewBox="0 0 448 512"
>
<path
- fill={CURRENT_COLOR}
+ fill={color}
d="M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"
/>
</svg>
diff --git a/packages/studio/src/icons/play.tsx b/packages/studio/src/icons/play.tsx
index 282f8ab30b..1865414fde 100644
--- a/packages/studio/src/icons/play.tsx
+++ b/packages/studio/src/icons/play.tsx
@@ -2,7 +2,10 @@ import type {SVGProps} from 'react';
import React from 'react';
import {CURRENT_COLOR} from '../helpers/colors';
-export const Play: React.FC<SVGProps<SVGSVGElement>> = (props) => (
+export const Play: React.FC<SVGProps<SVGSVGElement>> = ({
+ color = CURRENT_COLOR,
+ ...props
+}) => (
<svg
{...props}
aria-hidden="true"
@@ -15,7 +18,7 @@ export const Play: React.FC<SVGProps<SVGSVGElement>> = (props) => (
viewBox="0 0 448 512"
>
<path
- fill={CURRENT_COLOR}
+ fill={color}
d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"
/>
</svg>
diff --git a/packages/studio/src/icons/redo.tsx b/packages/studio/src/icons/redo.tsx
index 3a0f2100a1..288dc260a6 100644
--- a/packages/studio/src/icons/redo.tsx
+++ b/packages/studio/src/icons/redo.tsx
@@ -2,11 +2,14 @@ import type {SVGProps} from 'react';
import React from 'react';
import {CURRENT_COLOR} from '../helpers/colors';
-export const RedoIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => {
+export const RedoIcon: React.FC<SVGProps<SVGSVGElement>> = ({
+ color = CURRENT_COLOR,
+ ...props
+}) => {
return (
<svg viewBox="0 0 512 512" {...props}>
<path
- fill={CURRENT_COLOR}
+ fill={color}
d="M496 0c-8.8 0-16 7.2-16 16l0 103.8-37-39.1C394.4 29.2 326.8 0 256 0 114.6 0 0 114.6 0 256S114.6 512 256 512c98.3 0 183.6-55.4 226.5-136.5 4.1-7.8 1.1-17.5-6.7-21.6s-17.5-1.1-21.6 6.7C416.6 431.6 341.9 480 256 480 132.3 480 32 379.7 32 256S132.3 32 256 32c62 0 121.2 25.5 163.8 70.6L458.9 144 352 144c-8.8 0-16 7.2-16 16s7.2 16 16 16l144 0c8.8 0 16-7.2 16-16l0-144c0-8.8-7.2-16-16-16z"
/>
</svg>
diff --git a/packages/studio/src/icons/step-back.tsx b/packages/studio/src/icons/step-back.tsx
index 48dc6d4665..eb13034dc4 100644
--- a/packages/studio/src/icons/step-back.tsx
+++ b/packages/studio/src/icons/step-back.tsx
@@ -2,11 +2,14 @@ import type {SVGProps} from 'react';
import React from 'react';
import {CURRENT_COLOR} from '../helpers/colors';
-export const StepBack: React.FC<SVGProps<SVGSVGElement>> = (props) => {
+export const StepBack: React.FC<SVGProps<SVGSVGElement>> = ({
+ color = CURRENT_COLOR,
+ ...props
+}) => {
return (
<svg viewBox="0 0 448 512" {...props}>
<path
- fill={CURRENT_COLOR}
+ fill={color}
d="M64 468V44c0-6.6 5.4-12 12-12h48c6.6 0 12 5.4 12 12v176.4l195.5-181C352.1 22.3 384 36.6 384 64v384c0 27.4-31.9 41.7-52.5 24.6L136 292.7V468c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12z"
/>
</svg>
diff --git a/packages/studio/src/icons/step-forward.tsx b/packages/studio/src/icons/step-forward.tsx
index a36349deb5..ea641cb326 100644
--- a/packages/studio/src/icons/step-forward.tsx
+++ b/packages/studio/src/icons/step-forward.tsx
@@ -2,11 +2,14 @@ import type {SVGProps} from 'react';
import React from 'react';
import {CURRENT_COLOR} from '../helpers/colors';
-export const StepForward: React.FC<SVGProps<SVGSVGElement>> = (props) => {
+export const StepForward: React.FC<SVGProps<SVGSVGElement>> = ({
+ color = CURRENT_COLOR,
+ ...props
+}) => {
return (
<svg viewBox="0 0 448 512" {...props}>
<path
- fill={CURRENT_COLOR}
+ fill={color}
d="M384 44v424c0 6.6-5.4 12-12 12h-48c-6.6 0-12-5.4-12-12V291.6l-195.5 181C95.9 489.7 64 475.4 64 448V64c0-27.4 31.9-41.7 52.5-24.6L312 219.3V44c0-6.6 5.4-12 12-12h48c6.6 0 12 5.4 12 12z"
/>
</svg>
diff --git a/packages/studio/src/icons/undo.tsx b/packages/studio/src/icons/undo.tsx
index 76f077e209..c7b1b9f054 100644
--- a/packages/studio/src/icons/undo.tsx
+++ b/packages/studio/src/icons/undo.tsx
@@ -2,11 +2,14 @@ import type {SVGProps} from 'react';
import React from 'react';
import {CURRENT_COLOR} from '../helpers/colors';
-export const UndoIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => {
+export const UndoIcon: React.FC<SVGProps<SVGSVGElement>> = ({
+ color = CURRENT_COLOR,
+ ...props
+}) => {
return (
<svg viewBox="0 0 512 512" {...props}>
<path
- fill={CURRENT_COLOR}
+ fill={color}
d="M16 0c8.8 0 16 7.2 16 16l0 103.8 37-39.1C117.6 29.2 185.2 0 256 0 397.4 0 512 114.6 512 256S397.4 512 256 512c-98.3 0-183.6-55.4-226.5-136.5-4.1-7.8-1.1-17.5 6.7-21.6s17.5-1.1 21.6 6.7C95.4 431.6 170.1 480 256 480 379.7 480 480 379.7 480 256S379.7 32 256 32c-62 0-121.2 25.5-163.8 70.6L53.1 144 160 144c8.8 0 16 7.2 16 16s-7.2 16-16 16L16 176c-8.8 0-16-7.2-16-16L0 16C0 7.2 7.2 0 16 0z"
/>
</svg>