Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Refine Studio interface layout (#9364)

Jonny Burger6ee289f69036
diff --git a/packages/studio/src/components/AssetSelectorItem.tsx b/packages/studio/src/components/AssetSelectorItem.tsx
index 942cebf76d..96203498d0 100644
--- a/packages/studio/src/components/AssetSelectorItem.tsx
+++ b/packages/studio/src/components/AssetSelectorItem.tsx
@@ -16,7 +16,6 @@ import {
WHITE_ALPHA_06,
CURRENT_COLOR,
LIGHT_TEXT,
- SELECTED_BACKGROUND,
TRANSPARENT,
WHITE,
} from '../helpers/colors';
@@ -372,13 +371,7 @@ const AssetSelectorItem: React.FC<{
return {
...itemStyle,
color: hovered || selected ? WHITE : LIGHT_TEXT,
- backgroundColor: hovered
- ? selected
- ? SELECTED_BACKGROUND
- : WHITE_ALPHA_06
- : selected
- ? SELECTED_BACKGROUND
- : TRANSPARENT,
+ backgroundColor: hovered || selected ? WHITE_ALPHA_06 : TRANSPARENT,
paddingLeft: 12 + level * 8,
};
}, [hovered, level, selected]);
diff --git a/packages/studio/src/components/CompositionSelectorItem.tsx b/packages/studio/src/components/CompositionSelectorItem.tsx
index 5a9e3baa10..ecc60686de 100644
--- a/packages/studio/src/components/CompositionSelectorItem.tsx
+++ b/packages/studio/src/components/CompositionSelectorItem.tsx
@@ -18,9 +18,10 @@ import {StudioServerConnectionCtx} from '../helpers/client-id';
import {
BACKGROUND,
LIGHT_TEXT,
+ TRANSPARENT,
WHITE,
+ WHITE_ALPHA_06,
WHITE_ALPHA_12,
- getBackgroundFromHoverState,
} from '../helpers/colors';
import {getFolderId} from '../helpers/get-folder-id';
import {noop} from '../helpers/noop';
@@ -158,7 +159,9 @@ export const CompositionSelectorItem: React.FC<{
...itemStyle,
backgroundColor: dragHovered
? WHITE_ALPHA_12
- : getBackgroundFromHoverState({hovered, selected}),
+ : hovered || selected
+ ? WHITE_ALPHA_06
+ : TRANSPARENT,
paddingLeft: 12 + level * 8,
};
}, [dragHovered, hovered, level, selected]);
diff --git a/packages/studio/src/components/CurrentAsset.tsx b/packages/studio/src/components/CurrentAsset.tsx
index 82598c7c4e..daf4033f30 100644
--- a/packages/studio/src/components/CurrentAsset.tsx
+++ b/packages/studio/src/components/CurrentAsset.tsx
@@ -17,6 +17,7 @@ import {
InspectorInfoHeader,
InspectorInfoSubtitle,
} from './InspectorInfoHeader';
+import {INSPECTOR_PANEL_HORIZONTAL_PADDING} from './InspectorPanelLayout';
import {
getStaticFileRenameSelection,
useRenameStaticFile,
@@ -156,27 +157,40 @@ export const AssetInfo: React.FC<{
: [];
return (
- <InspectorInfoHeader contentSized={contentSized}>
+ <InspectorInfoHeader
+ contentSized={contentSized}
+ padding={
+ contentSized ? `0 ${INSPECTOR_PANEL_HORIZONTAL_PADDING}px 6px` : '4px 0'
+ }
+ >
<InlineEditableTitle
value={fileName}
canRename={canRename}
getInitialSelection={getStaticFileRenameSelection}
onClick={onAssetClick}
onCommit={onRename}
+ size={contentSized ? 'default' : 'inspector'}
title={assetName}
/>
{subtitleParts.length > 0 ? (
- <InspectorInfoSubtitle>
+ <InspectorInfoSubtitle size={contentSized ? 'default' : 'inspector'}>
{subtitleParts.join(' · ')}
</InspectorInfoSubtitle>
) : null}
{mediaMetadata ? (
- <InspectorInfoSubtitle>
+ <InspectorInfoSubtitle size={contentSized ? 'default' : 'inspector'}>
{formatMediaDuration(mediaMetadata.duration)}
</InspectorInfoSubtitle>
) : null}
{mediaDetailLines.map((line) => {
- return <InspectorInfoSubtitle key={line}>{line}</InspectorInfoSubtitle>;
+ return (
+ <InspectorInfoSubtitle
+ key={line}
+ size={contentSized ? 'default' : 'inspector'}
+ >
+ {line}
+ </InspectorInfoSubtitle>
+ );
})}
</InspectorInfoHeader>
);
diff --git a/packages/studio/src/components/InlineCompositionName.tsx b/packages/studio/src/components/InlineCompositionName.tsx
index b6eb81c9e7..15e7607be4 100644
--- a/packages/studio/src/components/InlineCompositionName.tsx
+++ b/packages/studio/src/components/InlineCompositionName.tsx
@@ -85,6 +85,7 @@ export const InlineCompositionName: React.FC<{
value={compositionId}
canRename={canRename}
onCommit={commit}
+ size="inspector"
/>
);
};
diff --git a/packages/studio/src/components/InlineEditableTitle.tsx b/packages/studio/src/components/InlineEditableTitle.tsx
index 68f5160f9a..5d46201903 100644
--- a/packages/studio/src/components/InlineEditableTitle.tsx
+++ b/packages/studio/src/components/InlineEditableTitle.tsx
@@ -6,11 +6,12 @@ import type {
} from 'react';
import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {
- WHITE_ALPHA_06,
INPUT_BACKGROUND,
TRANSPARENT,
WHITE,
+ getBackgroundFromHoverState,
} from '../helpers/colors';
+import {COMPACT_INLINE_ROW_HEIGHT} from './layout';
const titleWrapper: React.CSSProperties = {
boxSizing: 'border-box',
@@ -65,14 +66,59 @@ const titleInput: React.CSSProperties = {
width: '100%',
};
+const inspectorTitleWrapper: React.CSSProperties = {
+ ...titleWrapper,
+ fontFamily: 'sans-serif',
+ fontSize: 13,
+ height: COMPACT_INLINE_ROW_HEIGHT,
+ margin: '0 4px',
+ width: 'calc(100% - 8px)',
+};
+
+const inspectorTitleInner: React.CSSProperties = {
+ ...titleInner,
+ alignItems: 'center',
+ fontFamily: 'sans-serif',
+ fontSize: 13,
+ height: COMPACT_INLINE_ROW_HEIGHT,
+ paddingBottom: 0,
+ paddingLeft: 8,
+ paddingRight: 8,
+ paddingTop: 0,
+ width: '100%',
+};
+
+const inspectorTitleGridItem: React.CSSProperties = {
+ ...titleGridItem,
+ color: 'inherit',
+ fontFamily: 'sans-serif',
+ fontSize: 13,
+ lineHeight: '18px',
+};
+
+const inspectorTitleInput: React.CSSProperties = {
+ ...titleInput,
+ fontFamily: 'sans-serif',
+ fontSize: 13,
+};
+
export const InlineEditableTitle: React.FC<{
readonly value: string;
readonly canRename: boolean;
readonly getInitialSelection?: (value: string) => [number, number];
readonly onClick?: () => void;
readonly onCommit: (newValue: string) => void;
+ readonly size?: 'default' | 'inspector';
readonly title?: string;
-}> = ({value, canRename, getInitialSelection, onClick, onCommit, title}) => {
+}> = ({
+ value,
+ canRename,
+ getInitialSelection,
+ onClick,
+ onCommit,
+ size = 'default',
+ title,
+}) => {
const [isEditing, setIsEditing] = useState(false);
const [isHovered, setIsHovered] = useState(false);
const [draftValue, setDraftValue] = useState(value);
@@ -163,22 +209,37 @@ export const InlineEditableTitle: React.FC<{
const isInteractive = canRename || onClick !== undefined;
const backgroundColor = isEditing
? INPUT_BACKGROUND
- : isHovered && isInteractive
- ? WHITE_ALPHA_06
- : TRANSPARENT;
+ : getBackgroundFromHoverState({
+ hovered: isHovered && isInteractive,
+ selected: false,
+ });
+ const isInspectorSize = size === 'inspector';
const innerStyle = useMemo((): React.CSSProperties => {
return {
- ...titleInner,
+ ...(isInspectorSize ? inspectorTitleInner : titleInner),
backgroundColor,
- cursor: isEditing ? 'text' : isInteractive ? 'pointer' : 'default',
+ cursor: isEditing
+ ? 'text'
+ : isInspectorSize
+ ? 'text'
+ : isInteractive
+ ? 'pointer'
+ : 'default',
userSelect: isEditing ? 'text' : 'none',
- width: isEditing ? '100%' : undefined,
+ width: isEditing || isInspectorSize ? '100%' : undefined,
};
- }, [backgroundColor, isEditing, isInteractive]);
+ }, [backgroundColor, isEditing, isInspectorSize, isInteractive]);
+ const gridItemStyle = isInspectorSize
+ ? inspectorTitleGridItem
+ : titleGridItem;
+ const inputStyle = isInspectorSize ? inspectorTitleInput : titleInput;
return (
- <div style={titleWrapper} title={title ?? value}>
+ <div
+ style={isInspectorSize ? inspectorTitleWrapper : titleWrapper}
+ title={title ?? value}
+ >
<span
style={innerStyle}
onMouseEnter={() => setIsHovered(true)}
@@ -188,7 +249,7 @@ export const InlineEditableTitle: React.FC<{
<span
aria-hidden={isEditing}
style={{
- ...titleGridItem,
+ ...gridItemStyle,
visibility: isEditing ? 'hidden' : 'visible',
}}
>
@@ -197,7 +258,7 @@ export const InlineEditableTitle: React.FC<{
{isEditing ? (
<input
ref={focusInput}
- style={{...titleGridItem, ...titleInput}}
+ style={{...gridItemStyle, ...inputStyle}}
value={draftValue}
onChange={onChange}
onBlur={onBlur}
diff --git a/packages/studio/src/components/InspectorInfoHeader.tsx b/packages/studio/src/components/InspectorInfoHeader.tsx
index 77614a3150..4cb06fb7b4 100644
--- a/packages/studio/src/components/InspectorInfoHeader.tsx
+++ b/packages/studio/src/components/InspectorInfoHeader.tsx
@@ -49,16 +49,30 @@ const subtitle: React.CSSProperties = {
whiteSpace: 'nowrap',
};
+const inspectorSubtitle: React.CSSProperties = {
+ ...subtitle,
+ boxSizing: 'border-box',
+ fontFamily: 'sans-serif',
+ fontSize: 13,
+ height: 28,
+ lineHeight: '18px',
+ margin: '0 4px',
+ padding: '5px 8px',
+ width: 'calc(100% - 8px)',
+};
+
export const InspectorInfoHeader: React.FC<{
readonly children?: React.ReactNode;
readonly contentSized?: boolean;
readonly minHeight?: number;
-}> = ({children, contentSized = false, minHeight}) => {
- const style = contentSized
+ readonly padding?: React.CSSProperties['padding'];
+}> = ({children, contentSized = false, minHeight, padding}) => {
+ const sizeStyle = contentSized
? containerBase
: minHeight === undefined
? container
: {...containerBase, minHeight};
+ const style = padding === undefined ? sizeStyle : {...sizeStyle, padding};
return (
<div style={style}>
@@ -79,6 +93,11 @@ export const InspectorInfoTitle: React.FC<{
export const InspectorInfoSubtitle: React.FC<{
readonly children: React.ReactNode;
-}> = ({children}) => {
- return <div style={subtitle}>{children}</div>;
+ readonly size?: 'default' | 'inspector';
+}> = ({children, size = 'default'}) => {
+ return (
+ <div style={size === 'inspector' ? inspectorSubtitle : subtitle}>
+ {children}
+ </div>
+ );
};
diff --git a/packages/studio/src/components/InspectorLocationCopy.tsx b/packages/studio/src/components/InspectorLocationCopy.tsx
index 17129e8b4a..0ce584a3cb 100644
--- a/packages/studio/src/components/InspectorLocationCopy.tsx
+++ b/packages/studio/src/components/InspectorLocationCopy.tsx
@@ -25,8 +25,8 @@ const content: React.CSSProperties = {
const action: React.CSSProperties = {
flexShrink: 0,
height: 24,
- marginLeft: 4,
- marginRight: -4,
+ marginLeft: 0,
+ marginRight: 4,
};
const icon: React.CSSProperties = {
diff --git a/packages/studio/src/components/InspectorPanel/CompositionInspectorHeader.tsx b/packages/studio/src/components/InspectorPanel/CompositionInspectorHeader.tsx
index 2247cdbd51..b20e57a012 100644
--- a/packages/studio/src/components/InspectorPanel/CompositionInspectorHeader.tsx
+++ b/packages/studio/src/components/InspectorPanel/CompositionInspectorHeader.tsx
@@ -17,12 +17,10 @@ import {ReactIcon} from '../../icons/react';
import {StillIcon} from '../../icons/still';
import {FilmIcon} from '../../icons/video';
import {InlineCompositionName} from '../InlineCompositionName';
-import {
- InspectorInfoHeader,
- InspectorInfoSubtitle,
-} from '../InspectorInfoHeader';
+import {InspectorInfoHeader} from '../InspectorInfoHeader';
import {InspectorLocationCopy} from '../InspectorLocationCopy';
import {InspectorSourceLocation} from '../InspectorSourceLocation';
+import {COMPACT_INLINE_ROW_HEIGHT} from '../layout';
import {showNotification} from '../Notifications/NotificationCenter';
import {useResolvedStack} from '../Timeline/use-resolved-stack';
@@ -30,8 +28,13 @@ const COMPOSITION_INSPECTOR_HEADER_HEIGHT = 66;
const sourceLocationIconStyle: CSSProperties = {
flexShrink: 0,
- height: 13,
- width: 13,
+ height: 18,
+ width: 18,
+};
+
+const componentLocationPlaceholder: CSSProperties = {
+ flexShrink: 0,
+ height: COMPACT_INLINE_ROW_HEIGHT,
};
const renderReactIcon = (color: string) => {
@@ -122,33 +125,39 @@ export const CompositionInspectorHeader = () => {
);
return (
- <InspectorInfoHeader minHeight={COMPOSITION_INSPECTOR_HEADER_HEIGHT}>
+ <InspectorInfoHeader
+ minHeight={COMPOSITION_INSPECTOR_HEADER_HEIGHT}
+ padding="4px 0"
+ >
{video ? (
- <>
- <InspectorLocationCopy location={validatedLocation} name={video.id}>
- <InlineCompositionName
- key={video.id}
- compositionId={video.id}
- stack={currentComposition?.stack ?? null}
- compositions={compositions}
- />
- <InspectorSourceLocation
- location={validatedLocation}
- canOpen={validatedLocation !== null}
- onOpen={openFileLocation}
- renderIcon={renderCompositionIcon}
- />
+ <InspectorLocationCopy location={validatedLocation} name={video.id}>
+ <InlineCompositionName
+ key={video.id}
+ compositionId={video.id}
+ stack={currentComposition?.stack ?? null}
+ compositions={compositions}
+ />
+ <InspectorSourceLocation
+ location={validatedLocation}
+ canOpen={validatedLocation !== null}
+ onOpen={openFileLocation}
+ renderIcon={renderCompositionIcon}
+ size="inline-action"
+ />
+ {compositionComponentInfo === null &&
+ compositionFile !== null &&
+ compositionId !== null ? (
+ <div aria-hidden style={componentLocationPlaceholder} />
+ ) : (
<InspectorSourceLocation
location={componentLocation}
canOpen={componentLocation !== null}
onOpen={openComponentLocation}
renderIcon={renderReactIcon}
+ size="inline-action"
/>
- </InspectorLocationCopy>
- {isCompositionStill(video) ? (
- <InspectorInfoSubtitle>Still</InspectorInfoSubtitle>
- ) : null}
- </>
+ )}
+ </InspectorLocationCopy>
) : null}
</InspectorInfoHeader>
);
diff --git a/packages/studio/src/components/InspectorPanel/EasingInspector.tsx b/packages/studio/src/components/InspectorPanel/EasingInspector.tsx
index 0b1feffc7b..656c4a8463 100644
--- a/packages/studio/src/components/InspectorPanel/EasingInspector.tsx
+++ b/packages/studio/src/components/InspectorPanel/EasingInspector.tsx
@@ -25,7 +25,7 @@ import {
} from '../Timeline/update-selected-easing';
import {
InspectorActionSection,
- InspectorBackHeader,
+ InspectorBackAction,
InspectorInlineAction,
InspectorMessage,
InspectorSectionDivider,
@@ -34,7 +34,7 @@ import {getEasingSelectionFromCurrentKeyframes} from './easing-inspector-selecti
import {KeyframeEasingNavigator} from './KeyframeEasingNavigator';
import {KeyframeSettings} from './KeyframeSettings';
import {SequenceInspectorSections} from './SequenceInspectorHeader';
-import {sectionHeaderTitle, selectedContainer} from './styles';
+import {selectedContainer} from './styles';
import {useTrackForSelection} from './use-track-for-selection';
type EasingInspectorDetails = {
@@ -278,13 +278,13 @@ export const EasingInspector: React.FC<{
const renderHeader = useCallback(
() => (
<>
- <InspectorBackHeader
+ <InspectorBackAction
disabled={parentSelection === null}
onClick={onSelectParent}
title="Back to property"
>
- <div style={sectionHeaderTitle}>{fieldLabel}</div>
- </InspectorBackHeader>
+ {fieldLabel}
+ </InspectorBackAction>
<InspectorSectionDivider />
{easingUpdate === null || track === null ? null : (
<KeyframeEasingNavigator
diff --git a/packages/studio/src/components/InspectorPanel/KeyframeInspector.tsx b/packages/studio/src/components/InspectorPanel/KeyframeInspector.tsx
index 6cee3a9c57..837bc1729a 100644
--- a/packages/studio/src/components/InspectorPanel/KeyframeInspector.tsx
+++ b/packages/studio/src/components/InspectorPanel/KeyframeInspector.tsx
@@ -42,7 +42,8 @@ import {
import {TimelineSequenceKeyframedValue} from '../Timeline/TimelineSequencePropItem';
import {canEditEasingForInterpolationFunction} from '../Timeline/update-selected-easing';
import {
- InspectorBackHeader,
+ InspectorActionSection,
+ InspectorBackAction,
InspectorDetailRow,
InspectorInlineAction,
InspectorMessage,
@@ -57,10 +58,8 @@ import {SequenceInspectorSections} from './SequenceInspectorHeader';
import {
detailsBeforeInlineAction,
detailsWithInlineAction,
- keyframeEditorLabel,
keyframeEditorRow,
keyframeEditorValue,
- sectionHeaderTitle,
selectedContainer,
} from './styles';
import {useTrackForSelection} from './use-track-for-selection';
@@ -125,8 +124,8 @@ const makeMovedKeyframedDragOverride = ({
const removeKeyframeIcon: React.CSSProperties = {
display: 'block',
flexShrink: 0,
- height: 18,
- width: 18,
+ height: 16,
+ width: 16,
};
const TrashIcon: React.FC<{readonly color: string}> = ({color}) => {
@@ -134,7 +133,7 @@ const TrashIcon: React.FC<{readonly color: string}> = ({color}) => {
<svg viewBox="0 0 448 512" style={removeKeyframeIcon}>
<path
fill={color}
- d="M136.7 5.9C141.1-7.2 153.3-16 167.1-16l113.9 0c13.8 0 26 8.8 30.4 21.9L320 32 416 32c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l96 0 8.7-26.1zM32 144l384 0 0 304c0 35.3-28.7 64-64 64L96 512c-35.3 0-64-28.7-64-64l0-304zm88 64c-13.3 0-24 10.7-24 24l0 192c0 13.3 10.7 24 24 24s24-10.7 24-24l0-192c0-13.3-10.7-24-24-24zm104 0c-13.3 0-24 10.7-24 24l0 192c0 13.3 10.7 24 24 24s24-10.7 24-24l0-192c0-13.3-10.7-24-24-24zm104 0c-13.3 0-24 10.7-24 24l0 192c0 13.3 10.7 24 24 24s24-10.7 24-24l0-192c0-13.3-10.7-24-24-24z"
+ d="M160.5 27.4c2-6.8 8.3-11.4 15.3-11.4l96.4 0c7.1 0 13.3 4.6 15.3 11.4l11 36.6-149 0 11-36.6zM116.1 64L16 64C7.2 64 0 71.2 0 80S7.2 96 16 96l416 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-100.1 0-13.7-45.8C312.1-2.1 293.4-16 272.2-16l-96.4 0c-21.2 0-39.9 13.9-46 34.2L116.1 64zM28.7 144L51.6 452.7c2.5 33.4 30.3 59.3 63.8 59.3l217.1 0c33.5 0 61.3-25.9 63.8-59.3l22.9-308.7-32.1 0-22.7 306.4c-1.2 16.7-15.2 29.6-31.9 29.6l-217.1 0c-16.8 0-30.7-12.9-31.9-29.6L60.8 144 28.7 144z"
/>
</svg>
);
@@ -512,13 +511,13 @@ export const KeyframeInspector: React.FC<{
<div style={selectedContainer} className={VERTICAL_SCROLLBAR_CLASSNAME}>
<SequenceInspectorSections track={track} />
<InspectorSectionDivider />
- <InspectorBackHeader
+ <InspectorBackAction
disabled={parentSelection === null}
onClick={onSelectParent}
title="Back to property"
>
- <div style={sectionHeaderTitle}>{details.fieldLabel}</div>
- </InspectorBackHeader>
+ {details.fieldLabel}
+ </InspectorBackAction>
<InspectorSectionDivider />
<KeyframeEasingNavigator
currentSelection={selection}
@@ -550,35 +549,38 @@ export const KeyframeInspector: React.FC<{
/>
</InspectorDetailRow>
<div style={keyframeEditorRow}>
- <div style={keyframeEditorLabel}>{details.fieldLabel}</div>
- <div style={keyframeEditorValue}>
- {details.type === 'sequence' ? (
- <TimelineSequenceKeyframedValue
- field={details.field}
- fileName={details.fileName}
- nodePath={details.nodePath}
- schema={details.schema}
- propStatus={details.propStatus}
- sourceFrame={details.sourceFrame}
- />
- ) : (
- <TimelineEffectPropValue
- field={details.field}
- nodePath={details.nodePath}
- validatedLocation={details.validatedLocation}
- sourceFrame={details.sourceFrame}
- />
- )}
- </div>
+ <InspectorDetailRow label={details.fieldLabel}>
+ <div style={keyframeEditorValue}>
+ {details.type === 'sequence' ? (
+ <TimelineSequenceKeyframedValue
+ field={details.field}
+ fileName={details.fileName}
+ nodePath={details.nodePath}
+ schema={details.schema}
+ propStatus={details.propStatus}
+ sourceFrame={details.sourceFrame}
+ />
+ ) : (
+ <TimelineEffectPropValue
+ field={details.field}
+ nodePath={details.nodePath}
+ validatedLocation={details.validatedLocation}
+ sourceFrame={details.sourceFrame}
+ />
+ )}
+ </div>
+ </InspectorDetailRow>
</div>
</div>
- <InspectorInlineAction
- disabled={removeDisabled}
- onClick={onRemoveKeyframe}
- renderIcon={(color) => <TrashIcon color={color} />}
- >
- Remove keyframe
- </InspectorInlineAction>
+ <InspectorActionSection>
+ <InspectorInlineAction
+ disabled={removeDisabled}
+ onClick={onRemoveKeyframe}
+ renderIcon={(color) => <TrashIcon color={color} />}
+ >
+ Remove keyframe
+ </InspectorInlineAction>
+ </InspectorActionSection>
</div>
</div>
);
diff --git a/packages/studio/src/components/InspectorPanel/KeyframeSettings.tsx b/packages/studio/src/components/InspectorPanel/KeyframeSettings.tsx
index df4615bf4c..47b23a9def 100644
--- a/packages/studio/src/components/InspectorPanel/KeyframeSettings.tsx
+++ b/packages/studio/src/components/InspectorPanel/KeyframeSettings.tsx
@@ -212,7 +212,7 @@ export const KeyframeSettings: React.FC<{
selectedId={propStatus.clamping.left}
title="Extrapolate left"
style={comboStyle}
- small
+ size="small"
/>
</InspectorDetailRow>
<InspectorDetailRow label="Extrapolate right">
@@ -221,7 +221,7 @@ export const KeyframeSettings: React.FC<{
selectedId={propStatus.clamping.right}
title="Extrapolate right"
style={comboStyle}
- small
+ size="small"
/>
</InspectorDetailRow>
<InspectorDetailRow label="Output">
@@ -230,7 +230,7 @@ export const KeyframeSettings: React.FC<{
selectedId={propStatus.output ?? 'linear'}
title="Output"
style={comboStyle}
- small
+ size="small"
/>
</InspectorDetailRow>
</>
diff --git a/packages/studio/src/components/InspectorPanel/SequenceInspectorHeader.tsx b/packages/studio/src/components/InspectorPanel/SequenceInspectorHeader.tsx
index 5359171823..4a98e2e1f1 100644
--- a/packages/studio/src/components/InspectorPanel/SequenceInspectorHeader.tsx
+++ b/packages/studio/src/components/InspectorPanel/SequenceInspectorHeader.tsx
@@ -2,21 +2,46 @@ import React, {useCallback, useContext, useMemo} from 'react';
import type {CodePosition} from '../../error-overlay/react-overlay/utils/get-source-map';
import {StudioServerConnectionCtx} from '../../helpers/client-id';
import type {TrackWithHash} from '../../helpers/get-timeline-sequence-sort-key';
+import {ReactIcon} from '../../icons/react';
import {InlineEditableTitle} from '../InlineEditableTitle';
+import {InspectorInfoHeader} from '../InspectorInfoHeader';
import {InspectorLocationCopy} from '../InspectorLocationCopy';
import {InspectorSourceLocation} from '../InspectorSourceLocation';
+import {COMPACT_INLINE_ROW_HEIGHT} from '../layout';
import {useOpenSequenceInEditor} from '../Timeline/use-open-sequence-in-editor';
import {useRenameSequence} from '../Timeline/use-rename-sequence';
-import {InspectorSectionDivider} from './common';
+import {InspectorInlineAction, InspectorSectionDivider} from './common';
import {
ConnectedCompositionsSection,
useConnectedCompositions,
} from './ConnectedCompositionsSection';
-import {
- sequenceHeader,
- sequenceHeaderSubtitle,
- sequenceHeaderTitle,
-} from './styles';
+import {sequenceHeaderSubtitle} from './styles';
+
+const sourceLocationIconStyle: React.CSSProperties = {
+ flexShrink: 0,
+ height: 18,
+ width: 18,
+};
+
+const renderReactIcon = (color: string) => {
+ return <ReactIcon color={color} style={sourceLocationIconStyle} />;
+};
+
+const sequenceInspectorSubtitle: React.CSSProperties = {
+ ...sequenceHeaderSubtitle,
+ alignItems: 'center',
+ boxSizing: 'border-box',
+ fontSize: 13,
+ height: COMPACT_INLINE_ROW_HEIGHT,
+ lineHeight: '18px',
+ margin: '0 4px',
+ padding: '0 8px',
+ width: 'calc(100% - 8px)',
+};
+
+const defaultCursor: React.CSSProperties = {
+ cursor: 'default',
+};
type SequenceInspectorSourceLocation = {
readonly canOpenInEditor: boolean;
@@ -89,7 +114,7 @@ export const SequenceInspectorHeader: React.FC<{
const subtitleStyle = useMemo((): React.CSSProperties => {
return {
- ...sequenceHeaderSubtitle,
+ ...sequenceInspectorSubtitle,
cursor: documentationLink ? 'pointer' : 'default',
};
}, [documentationLink]);
@@ -103,27 +128,27 @@ export const SequenceInspectorHeader: React.FC<{
);
return (
- <div style={sequenceHeader}>
+ <InspectorInfoHeader contentSized padding="4px 0">
<InspectorLocationCopy
location={sourceLocation.validatedLocation}
name={componentName ?? null}
>
- <div style={sequenceHeaderTitle}>
- <InlineEditableTitle
- value={sequenceDisplayName}
- canRename={canRename}
- onCommit={onRename}
- />
- </div>
+ <InlineEditableTitle
+ value={sequenceDisplayName}
+ canRename={canRename}
+ onCommit={onRename}
+ size="inspector"
+ />
{documentationLink ? (
- <button
- type="button"
- style={subtitleStyle}
+ <InspectorInlineAction
+ disabled={false}
+ style={defaultCursor}
+ size="compact"
title="Open component docs"
onClick={openDocumentationLink}
>
{componentName}
- </button>
+ </InspectorInlineAction>
) : (
<div style={subtitleStyle}>{componentName}</div>
)}
@@ -131,9 +156,11 @@ export const SequenceInspectorHeader: React.FC<{
location={sourceLocation.validatedLocation}
canOpen={sourceLocation.canOpenInEditor}
onOpen={sourceLocation.openFileLocation}
+ renderIcon={renderReactIcon}
+ size="inline-action"
/>
</InspectorLocationCopy>
- </div>
+ </InspectorInfoHeader>
);
};
diff --git a/packages/studio/src/components/InspectorPanel/SequenceSelectionInspector.tsx b/packages/studio/src/components/InspectorPanel/SequenceSelectionInspector.tsx
index 3148438023..de02cbf724 100644
--- a/packages/studio/src/components/InspectorPanel/SequenceSelectionInspector.tsx
+++ b/packages/studio/src/components/InspectorPanel/SequenceSelectionInspector.tsx
@@ -37,8 +37,8 @@ import {selectedContainer} from './styles';
import {useTrackForSelection} from './use-track-for-selection';
const splitIconStyle: React.CSSProperties = {
- height: 18,
- width: 18,
+ height: 16,
+ width: 16,
};
const SplitSequenceAction: React.FC<{
diff --git a/packages/studio/src/components/InspectorPanel/common.tsx b/packages/studio/src/components/InspectorPanel/common.tsx
index 30a8c99667..0901c0afe7 100644
--- a/packages/studio/src/components/InspectorPanel/common.tsx
+++ b/packages/studio/src/components/InspectorPanel/common.tsx
@@ -5,9 +5,8 @@ import {
WHITE,
getBackgroundFromHoverState,
} from '../../helpers/colors';
-import {InlineAction} from '../InlineAction';
import {INSPECTOR_PANEL_HORIZONTAL_PADDING} from '../InspectorPanelLayout';
-import {COMPACT_CONTROL_ROW_HEIGHT} from '../layout';
+import {COMPACT_CONTROL_ROW_HEIGHT, COMPACT_INLINE_ROW_HEIGHT} from '../layout';
import {ValidationMessage} from '../NewComposition/ValidationMessage';
import type {RenderModalWarning} from '../RenderModal/DataEditor';
import {
@@ -21,8 +20,6 @@ import {
inspectorSectionDivider,
resolveLinkStyle,
sectionHeader,
- sectionHeaderRow,
- sectionHeaderStart,
} from './styles';
export const InspectorSectionHeader: React.FC<{
@@ -57,51 +54,42 @@ export const InspectorSection: React.FC<{
);
};
-const backIcon: React.CSSProperties = {
- alignItems: 'center',
- display: 'flex',
- height: 12,
- justifyContent: 'center',
- width: 12,
+const backArrowIcon: React.CSSProperties = {
+ display: 'block',
+ height: 15,
+ width: 15,
};
-const BackChevron: React.FC<{
+const BackArrow: React.FC<{
readonly color: string;
}> = ({color}) => {
return (
- <svg viewBox="0 0 8 12" style={backIcon}>
+ <svg viewBox="0 0 512 512" style={backArrowIcon}>
<path
- d="M6 1L2 6L6 11"
- fill="none"
- stroke={color}
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth="1.5"
+ d="M7 239c-9.4 9.4-9.4 24.6 0 33.9L175 441c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L81.9 280 488 280c13.3 0 24-10.7 24-24s-10.7-24-24-24L81.9 232 209 105c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L7 239z"
+ fill={color}
/>
</svg>
);
};
-export const InspectorBackHeader: React.FC<{
+export const InspectorBackAction: React.FC<{
readonly children: React.ReactNode;
readonly disabled: boolean;
readonly onClick: React.MouseEventHandler<HTMLButtonElement>;
readonly title: string;
}> = ({children, disabled, onClick, title}) => {
return (
- <InspectorSectionHeader>
- <div style={sectionHeaderRow}>
- <div style={sectionHeaderStart}>
- <InlineAction
- disabled={disabled}
- onClick={onClick}
- title={title}
- renderAction={(color) => <BackChevron color={color} />}
- />
- {children}
- </div>
- </div>
- </InspectorSectionHeader>
+ <div style={inspectorActionSection}>
+ <InspectorInlineAction
+ disabled={disabled}
+ onClick={onClick}
+ renderIcon={(color) => <BackArrow color={color} />}
+ title={title}
+ >
+ {children}
+ </InspectorInlineAction>
+ </div>
);
};
@@ -137,7 +125,7 @@ const inlineLabelButton: React.CSSProperties = {
height: COMPACT_CONTROL_ROW_HEIGHT,
lineHeight: '18px',
margin: `0 ${INLINE_LABEL_BUTTON_MARGIN}px`,
- padding: `5px ${INSPECTOR_PANEL_HORIZONTAL_PADDING - INLINE_LABEL_BUTTON_MARGIN}px`,
+ padding: `0 ${INSPECTOR_PANEL_HORIZONTAL_PADDING - INLINE_LABEL_BUTTON_MARGIN}px`,
textAlign: 'left',
width: `calc(100% - ${INLINE_LABEL_BUTTON_MARGIN * 2}px)`,
};
@@ -147,6 +135,10 @@ const inlineLabelButtonDisabled: React.CSSProperties = {
opacity: 0.35,
};
+const compactInlineLabelButton: React.CSSProperties = {
+ height: COMPACT_INLINE_ROW_HEIGHT,
+};
+
const inlineLabelText: React.CSSProperties = {
color: LIGHT_TEXT,
flex: 1,
@@ -172,9 +164,19 @@ export const InspectorInlineAction: React.FC<{
readonly children: React.ReactNode;
readonly disabled: boolean;
readonly onClick: React.MouseEventHandler<HTMLButtonElement>;
- readonly renderIcon: (color: string) => React.ReactNode;
+ readonly renderIcon?: (color: string) => React.ReactNode;
+ readonly size?: 'default' | 'compact';
readonly style?: React.CSSProperties;
-}> = ({children, disabled, onClick, renderIcon, style}) => {
+ readonly title?: string;
+}> = ({
+ children,
+ disabled,
+ onClick,
+ renderIcon,
+ size = 'default',
+ style,
+ title,
+}) => {
const [hovered, setHovered] = React.useState(false);
const color = hovered && !disabled ? WHITE : LIGHT_TEXT;
const buttonStyle = React.useMemo(
@@ -185,9 +187,10 @@ export const InspectorInlineAction: React.FC<{
selected: false,
}),
color,
+ ...(size === 'compact' ? compactInlineLabelButton : null),
...style,
}),
- [color, disabled, hovered, style],
+ [color, disabled, hovered, size, style],
);
const textStyle = React.useMemo(
(): React.CSSProperties => ({
@@ -206,14 +209,18 @@ export const InspectorInlineAction: React.FC<{
return (
<button
+ className="__remotion-inspector-inline-action"
type="button"
disabled={disabled}
style={buttonStyle}
+ title={title}
onClick={onClick}
onPointerEnter={disabled ? undefined : onPointerEnter}
onPointerLeave={onPointerLeave}
>
- <span style={inlineLabelIcon}>{renderIcon(color)}</span>
+ {renderIcon ? (
+ <span style={inlineLabelIcon}>{renderIcon(color)}</span>
+ ) : null}
<span style={textStyle}>{children}</span>
</button>
);
diff --git a/packages/studio/src/components/InspectorPanel/styles.ts b/packages/studio/src/components/InspectorPanel/styles.ts
index a702f2b700..af656cc16a 100644
--- a/packages/studio/src/components/InspectorPanel/styles.ts
+++ b/packages/studio/src/components/InspectorPanel/styles.ts
@@ -64,33 +64,6 @@ export const inspectorSectionBody: React.CSSProperties = {
paddingBottom: 8,
};
-export const sequenceHeader: React.CSSProperties = {
- backgroundColor: BACKGROUND,
- display: 'flex',
- flexDirection: 'column',
- minWidth: 0,
- padding: `6px ${INSPECTOR_PANEL_HORIZONTAL_PADDING}px 4px`,
-};
-
-export const sequenceHeaderTitle: React.CSSProperties = {
- alignSelf: 'stretch',
- backgroundColor: BACKGROUND,
- border: 'none',
- color: WHITE,
- display: 'flex',
- fontFamily: 'sans-serif',
- fontSize: 12,
- lineHeight: '18px',
- margin: 0,
- maxWidth: '100%',
- minWidth: 0,
- overflow: 'hidden',
- padding: 0,
- textAlign: 'left',
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap',
-};
-
export const sequenceHeaderSubtitle: React.CSSProperties = {
alignSelf: 'flex-start',
backgroundColor: BACKGROUND,
@@ -214,6 +187,10 @@ export const detailRow: React.CSSProperties = {
export const detailLabel: React.CSSProperties = {
color: LIGHT_TEXT,
fontSize: 13,
+ minWidth: 0,
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
};
export const detailValue: React.CSSProperties = {
@@ -226,24 +203,9 @@ export const detailValue: React.CSSProperties = {
};
export const keyframeEditorRow: React.CSSProperties = {
- alignItems: 'flex-start',
- display: 'flex',
- gap: 12,
- justifyContent: 'space-between',
- minWidth: 0,
padding: '10px 0',
};
-export const keyframeEditorLabel: React.CSSProperties = {
- color: LIGHT_TEXT,
- fontSize: 13,
- lineHeight: '22px',
- minWidth: 0,
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap',
-};
-
export const keyframeEditorValue: React.CSSProperties = {
alignItems: 'center',
display: 'flex',
diff --git a/packages/studio/src/components/InspectorSequenceSection.tsx b/packages/studio/src/components/InspectorSequenceSection.tsx
index 42c767bf01..ed1e6399a8 100644
--- a/packages/studio/src/components/InspectorSequenceSection.tsx
+++ b/packages/studio/src/components/InspectorSequenceSection.tsx
@@ -3,6 +3,7 @@ import type {TSequence} from 'remotion';
import type {CodePosition} from '../error-overlay/react-overlay/utils/get-source-map';
import {StudioServerConnectionCtx} from '../helpers/client-id';
import {LIGHT_TEXT, WHITE} from '../helpers/colors';
+import {getPreviewFileType} from '../helpers/get-preview-file-type';
import type {SequenceNodePathInfo} from '../helpers/get-timeline-sequence-sort-key';
import {
flattenVisibleTreeNodes,
@@ -13,9 +14,9 @@ import {
} from '../helpers/timeline-layout';
import {Plus} from '../icons/plus';
import {ModalsContext} from '../state/modals';
-import {AssetInfo} from './CurrentAsset';
+import {AssetFileIcon} from './AssetFileIcon';
import {InlineAction} from './InlineAction';
-import {InspectorSection} from './InspectorPanel/common';
+import {InspectorInlineAction, InspectorSection} from './InspectorPanel/common';
import {sectionHeaderRow, sectionHeaderTitle} from './InspectorPanel/styles';
import {INSPECTOR_PANEL_HORIZONTAL_PADDING} from './InspectorPanelLayout';
import {
@@ -63,6 +64,12 @@ const plusIcon: React.CSSProperties = {
height: 15,
};
+const assetSelectorIcon: React.CSSProperties = {
+ flexShrink: 0,
+ height: 18,
+ width: 18,
+};
+
const remoteSourceLabel: React.CSSProperties = {
color: LIGHT_TEXT,
display: 'flex',
@@ -231,6 +238,9 @@ export const InspectorSequenceSection: React.FC<{
openTimelineAssetLink(localAsset, selectAsset);
}
}, [localAsset, selectAsset]);
+ const localAssetFileName = localAsset
+ ? (localAsset.assetPath.split('/').pop() ?? localAsset.assetPath)
+ : null;
const getIsExpanded = useCallback(
(candidate: SequenceNodePathInfo) => {
@@ -378,12 +388,21 @@ export const InspectorSequenceSection: React.FC<{
{controlGroups.map((group) => (
<InspectorSection key={group.id} header={group.label}>
{group.id === 'source' && localAsset ? (
- <AssetInfo
- assetName={localAsset.assetPath}
- contentSized
- onAssetClick={jumpToAsset}
- readOnlyStudio
- />
+ <InspectorInlineAction
+ disabled={false}
+ onClick={jumpToAsset}
+ renderIcon={(color) => (
+ <AssetFileIcon
+ color={color}
+ fileType={getPreviewFileType(localAsset.assetPath)}
+ style={assetSelectorIcon}
+ />
+ )}
+ size="compact"
+ title={localAsset.assetPath}
+ >
+ {localAssetFileName}
+ </InspectorInlineAction>
) : null}
{group.id === 'source' && remoteAsset && remoteSourceParts ? (
<div style={remoteSourceLabel} title={remoteAsset.href}>
diff --git a/packages/studio/src/components/InspectorSourceLocation.tsx b/packages/studio/src/components/InspectorSourceLocation.tsx
index 2f10719d36..96245e35b7 100644
--- a/packages/studio/src/components/InspectorSourceLocation.tsx
+++ b/packages/studio/src/components/InspectorSourceLocation.tsx
@@ -2,6 +2,7 @@ import React, {useCallback, useMemo, useState} from 'react';
import type {OriginalPosition} from '../error-overlay/react-overlay/utils/get-source-map';
import {BACKGROUND, LIGHT_COLOR, LIGHT_TEXT} from '../helpers/colors';
import {formatFileLocation} from '../helpers/format-file-location';
+import {InspectorInlineAction} from './InspectorPanel/common';
import {getOriginalSourceAttribution} from './Timeline/TimelineStack/source-attribution';
const sourceLocationStyle: React.CSSProperties = {
@@ -45,7 +46,8 @@ export const InspectorSourceLocation: React.FC<{
readonly canOpen: boolean;
readonly onOpen: () => void;
readonly renderIcon?: (color: string) => React.ReactNode;
-}> = ({location, canOpen, onOpen, renderIcon}) => {
+ readonly size?: 'default' | 'inline-action';
+}> = ({location, canOpen, onOpen, renderIcon, size = 'default'}) => {
const [hovered, setHovered] = useState(false);
const validLocation = useMemo((): OriginalPosition | null => {
@@ -96,6 +98,20 @@ export const InspectorSourceLocation: React.FC<{
return null;
}
+ if (size === 'inline-action') {
+ return (
+ <InspectorInlineAction
+ disabled={!canOpen}
+ onClick={onClick}
+ renderIcon={(iconColor) => renderIcon?.(iconColor)}
+ size="compact"
+ title={fileLocation ?? undefined}
+ >
+ {label}
+ </InspectorInlineAction>
+ );
+ }
+
return (
<button
type="button"
diff --git a/packages/studio/src/components/NewComposition/ComboBox.tsx b/packages/studio/src/components/NewComposition/ComboBox.tsx
index 213df5e6d2..b023eb2e8e 100644
--- a/packages/studio/src/components/NewComposition/ComboBox.tsx
+++ b/packages/studio/src/components/NewComposition/ComboBox.tsx
@@ -12,7 +12,7 @@ import {useMobileLayout} from '../../helpers/mobile-layout';
import {noop} from '../../helpers/noop';
import {CaretDown} from '../../icons/caret';
import {HigherZIndex, useZIndex} from '../../state/z-index';
-import {Spacing} from '../layout';
+import {COMPACT_CONTROL_ROW_HEIGHT, Spacing} from '../layout';
import {MENU_INITIATOR_CLASSNAME, isMenuItem} from '../Menu/is-menu-item';
import {getPortal} from '../Menu/portals';
import {
@@ -31,9 +31,19 @@ const container: React.CSSProperties = {
backgroundColor: INPUT_BACKGROUND,
borderWidth: 1,
borderStyle: 'solid',
+ borderRadius: 4,
+ fontFamily: 'inherit',
maxWidth: '100%',
};
+const compactContainer: React.CSSProperties = {
+ ...container,
+ boxSizing: 'border-box',
+ borderRadius: 0,
+ height: COMPACT_CONTROL_ROW_HEIGHT + 2,
+ padding: '5px 6px',
+};
+
const smallContainer: React.CSSProperties = {
...container,
padding: '3px 4px',
@@ -43,17 +53,29 @@ const label: React.CSSProperties = {
flex: 1,
overflow: 'hidden',
textOverflow: 'ellipsis',
+ color: 'inherit',
+ fontFamily: 'inherit',
fontSize: 14,
+ lineHeight: '21px',
+ minWidth: 0,
textAlign: 'left',
whiteSpace: 'nowrap',
};
+const compactLabel: React.CSSProperties = {
+ ...label,
+ fontSize: 12,
+ lineHeight: '16px',
+};
+
const smallLabel: React.CSSProperties = {
...label,
fontSize: 11,
- lineHeight: 1,
+ lineHeight: '12px',
};
+export type ComboboxSize = 'default' | 'compact' | 'small';
+
type DividerItem = {
type: 'divider';
id: string;
@@ -85,8 +107,14 @@ export const Combobox: React.FC<{
readonly selectedId: string | number;
readonly style?: React.CSSProperties;
readonly title: string;
- readonly small?: boolean;
-}> = ({values, selectedId, style: customStyle, title, small = false}) => {
+ readonly size?: ComboboxSize;
+}> = ({
+ values,
+ selectedId,
+ style: customStyle,
+ title,
+ size: controlSize = 'default',
+}) => {
const [hovered, setIsHovered] = useState(false);
const [opened, setOpened] = useState(false);
const ref = useRef<HTMLButtonElement>(null);
@@ -240,7 +268,11 @@ export const Combobox: React.FC<{
const style = useMemo((): React.CSSProperties => {
return {
- ...(small ? smallContainer : container),
+ ...(controlSize === 'small'
+ ? smallContainer
+ : controlSize === 'compact'
+ ? compactContainer
+ : container),
...(customStyle ?? {}),
userSelect: 'none',
WebkitUserSelect: 'none',
@@ -254,7 +286,14 @@ export const Combobox: React.FC<{
? WHITE_ALPHA_05
: BLACK_ALPHA_60,
};
- }, [customStyle, hovered, opened, small]);
+ }, [controlSize, customStyle, hovered, opened]);
+
+ const selectedLabelStyle =
+ controlSize === 'small'
+ ? smallLabel
+ : controlSize === 'compact'
+ ? compactLabel
+ : label;
return (
<>
@@ -271,12 +310,13 @@ export const Combobox: React.FC<{
title={
typeof selected.label === 'string' ? selected.label : undefined
}
- style={small ? smallLabel : label}
+ style={selectedLabelStyle}
>
{selected?.label}
</div>
) : null}
- <Spacing x={small ? 0.5 : 1} /> <CaretDown small={small} />
+ <Spacing x={controlSize === 'default' ? 1 : 0.5} />{' '}
+ <CaretDown small={controlSize === 'small'} />
</button>
{portalStyle
? ReactDOM.createPortal(
diff --git a/packages/studio/src/components/PlaybackRateSelector.tsx b/packages/studio/src/components/PlaybackRateSelector.tsx
index 6337423c3d..fc3f38883f 100644
--- a/packages/studio/src/components/PlaybackRateSelector.tsx
+++ b/packages/studio/src/components/PlaybackRateSelector.tsx
@@ -17,7 +17,7 @@ const getPlaybackRateLabel = (playbackRate: number) => {
const accessibilityLabel = 'Change the playback rate';
-const comboStyle: React.CSSProperties = {width: 80};
+const comboStyle: React.CSSProperties = {width: 64};
export const PlaybackRateSelector: React.FC<{
readonly playbackRate: number;
@@ -27,7 +27,7 @@ export const PlaybackRateSelector: React.FC<{
const isStill = useIsStill();
const style = useMemo(() => {
return {
- padding: CONTROL_BUTTON_PADDING,
+ padding: CONTROL_BUTTON_PADDING - 2,
};
}, []);
@@ -68,6 +68,7 @@ export const PlaybackRateSelector: React.FC<{
return (
<div style={style} aria-label={accessibilityLabel}>
<Combobox
+ size="compact"
title={accessibilityLabel}
style={comboStyle}
selectedId={String(playbackRate)}
diff --git a/packages/studio/src/components/PreviewToolbar.tsx b/packages/studio/src/components/PreviewToolbar.tsx
index a05e594e38..458cfe6887 100644
--- a/packages/studio/src/components/PreviewToolbar.tsx
+++ b/packages/studio/src/components/PreviewToolbar.tsx
@@ -36,7 +36,7 @@ import {SnappingToggle} from './SnappingToggle';
import {TimelineZoomControls} from './Timeline/TimelineZoomControls';
import {TimelineInOutPointToggle} from './TimelineInOutToggle';
-const TOOLBAR_HEIGHT = 50;
+const TOOLBAR_HEIGHT = 40;
const container: React.CSSProperties = {
display: 'flex',
@@ -78,7 +78,7 @@ const scrollIndicatorRight: React.CSSProperties = {
const sideContainer: React.CSSProperties = {
width: 300,
- height: 36,
+ height: 30,
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
@@ -296,7 +296,7 @@ export const PreviewToolbar: React.FC<{
{!isMobileLayout && <FpsCounter playbackSpeed={playbackRate} />}
<Spacing x={2} />
<PreviewToolbarControl>
- <RenderButton readOnlyStudio={readOnlyStudio} />
+ <RenderButton readOnlyStudio={readOnlyStudio} size="compact" />
</PreviewToolbarControl>
<Spacing x={1.5} />
</div>
diff --git a/packages/studio/src/components/RenderButton.tsx b/packages/studio/src/components/RenderButton.tsx
index d0ddf377ca..d84a2f2e83 100644
--- a/packages/studio/src/components/RenderButton.tsx
+++ b/packages/studio/src/components/RenderButton.tsx
@@ -28,7 +28,7 @@ import {ThinRenderIcon} from '../icons/render';
import {useTimelineInOutFramePosition} from '../state/in-out';
import {ModalsContext} from '../state/modals';
import {HigherZIndex, useZIndex} from '../state/z-index';
-import {Row, Spacing} from './layout';
+import {COMPACT_CONTROL_ROW_HEIGHT, Row, Spacing} from './layout';
import {MENU_INITIATOR_CLASSNAME, isMenuItem} from './Menu/is-menu-item';
import {getPortal} from './Menu/portals';
import {
@@ -87,10 +87,53 @@ const dropdownTriggerStyle: React.CSSProperties = {
const mainButtonContent: React.CSSProperties = {
paddingLeft: 4,
paddingRight: 6,
+ minWidth: 0,
};
const label: React.CSSProperties = {
+ color: 'inherit',
+ fontFamily: 'inherit',
fontSize: 14,
+ lineHeight: '21px',
+ minWidth: 0,
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+};
+
+const compactSplitButtonSegmentHeight = COMPACT_CONTROL_ROW_HEIGHT;
+
+const compactMainButtonStyle: React.CSSProperties = {
+ ...mainButtonStyle,
+ boxSizing: 'border-box',
+ height: compactSplitButtonSegmentHeight,
+ paddingLeft: 6,
+ paddingRight: 6,
+ paddingTop: 6,
+ paddingBottom: 6,
+ fontSize: 12,
+};
+
+const compactDropdownTriggerStyle: React.CSSProperties = {
+ ...dropdownTriggerStyle,
+ boxSizing: 'border-box',
+ height: compactSplitButtonSegmentHeight,
+ paddingLeft: 5,
+ paddingRight: 5,
+ paddingTop: 6,
+ paddingBottom: 6,
+};
+
+const compactMainButtonContent: React.CSSProperties = {
+ ...mainButtonContent,
+ paddingLeft: 2,
+ paddingRight: 4,
+};
+
+const compactLabel: React.CSSProperties = {
+ ...label,
+ fontSize: 12,
+ lineHeight: '16px',
};
export type RenderType = 'server-render' | 'client-render' | 'render-command';
@@ -114,9 +157,10 @@ const getInitialRenderType = (readOnlyStudio: boolean): RenderType => {
return 'server-render';
};
-export const RenderButton: React.FC<{readonly readOnlyStudio: boolean}> = ({
- readOnlyStudio,
-}) => {
+export const RenderButton: React.FC<{
+ readonly readOnlyStudio: boolean;
+ readonly size?: 'default' | 'compact';
+}> = ({readOnlyStudio, size: controlSize = 'default'}) => {
const {inFrame, outFrame} = useTimelineInOutFramePosition();
const {setSelectedModal} = useContext(ModalsContext);
const [preferredRenderType, setPreferredRenderType] = useState<RenderType>(
@@ -215,11 +259,12 @@ export const RenderButton: React.FC<{readonly readOnlyStudio: boolean}> = ({
const iconStyle: SVGProps<SVGSVGElement> = useMemo(() => {
return {
style: {
- height: 16,
+ height: controlSize === 'compact' ? 14 : 16,
color: CURRENT_COLOR,
+ flexShrink: 0,
},
};
- }, []);
+ }, [controlSize]);
const video = Internals.useVideo();
const {getCurrentFrame} = PlayerInternals.usePlayer();
@@ -476,10 +521,11 @@ export const RenderButton: React.FC<{readonly readOnlyStudio: boolean}> = ({
return {
...splitButtonContainer,
borderColor: BLACK_ALPHA_60,
+ borderRadius: controlSize === 'compact' ? 0 : 4,
opacity: 1,
cursor: 'pointer',
};
- }, []);
+ }, [controlSize]);
const renderLabel =
renderType === 'server-render'
@@ -510,24 +556,39 @@ export const RenderButton: React.FC<{readonly readOnlyStudio: boolean}> = ({
<div ref={containerRef} style={containerStyle} title={tooltip}>
<button
type="button"
- style={mainButtonStyle}
+ style={
+ controlSize === 'compact' ? compactMainButtonStyle : mainButtonStyle
+ }
onClick={onClick}
id="render-modal-button"
>
- <Row align="center" style={mainButtonContent}>
+ <Row
+ align="center"
+ style={
+ controlSize === 'compact'
+ ? compactMainButtonContent
+ : mainButtonContent
+ }
+ >
<ThinRenderIcon
fill={CURRENT_COLOR_LOWERCASE}
svgProps={iconStyle}
/>
- <Spacing x={1} />
- <span style={label}>{renderLabel}</span>
+ <Spacing x={controlSize === 'compact' ? 0.75 : 1} />
+ <span style={controlSize === 'compact' ? compactLabel : label}>
+ {renderLabel}
+ </span>
</Row>
</button>
<div style={dividerStyle} />
<button
ref={dropdownRef}
type="button"
- style={dropdownTriggerStyle}
+ style={
+ controlSize === 'compact'
+ ? compactDropdownTriggerStyle
+ : dropdownTriggerStyle
+ }
className={MENU_INITIATOR_CLASSNAME}
onPointerDown={onPointerDown}
onClick={onClickDropdown}
diff --git a/packages/studio/src/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.tsx b/packages/studio/src/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.tsx
index 7a6a139da9..ba9cfa6f98 100644
--- a/packages/studio/src/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.tsx
+++ b/packages/studio/src/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.tsx
@@ -92,7 +92,7 @@ export const ZodDiscriminatedUnionEditor: React.FC<{
title="Select type"
values={comboBoxValues}
selectedId={value[discriminator] as string}
- small
+ size="small"
/>
</Fieldset>
),
diff --git a/packages/studio/src/components/RenderModal/SchemaEditor/ZodEnumEditor.tsx b/packages/studio/src/components/RenderModal/SchemaEditor/ZodEnumEditor.tsx
index 92ef1873d2..f7f2c22bf0 100644
--- a/packages/studio/src/components/RenderModal/SchemaEditor/ZodEnumEditor.tsx
+++ b/packages/studio/src/components/RenderModal/SchemaEditor/ZodEnumEditor.tsx
@@ -74,7 +74,7 @@ export const ZodEnumEditor: React.FC<{
values={comboBoxValues}
selectedId={value}
title={value}
- small
+ size="small"
/>
</div>
<ZodFieldValidation path={jsonPath} zodValidation={zodValidation} />
diff --git a/packages/studio/src/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx b/packages/studio/src/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx
index f6167a8ae6..d11bd68b8f 100644
--- a/packages/studio/src/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx
+++ b/packages/studio/src/components/RenderModal/SchemaEditor/ZodStaticFileEditor.tsx
@@ -73,7 +73,7 @@ export const ZodStaticFileEditor: React.FC<{
values={comboBoxValues}
selectedId={value}
title={value}
- small
+ size="small"
/>
</div>
<ZodFieldValidation path={jsonPath} zodValidation={zodValidation} />
diff --git a/packages/studio/src/components/SizeSelector.tsx b/packages/studio/src/components/SizeSelector.tsx
index 65eaa3c0b0..8304274d3a 100644
--- a/packages/studio/src/components/SizeSelector.tsx
+++ b/packages/studio/src/components/SizeSelector.tsx
@@ -49,7 +49,7 @@ export const getPreviewSizeLabel = (previewSize: PreviewSize) => {
const accessibilityLabel = 'Preview Size';
-const comboStyle: React.CSSProperties = {width: 80};
+const comboStyle: React.CSSProperties = {width: 64};
export const getUniqueSizes = (size: PreviewSize) => {
const customPreviewSizes = [size, ...commonPreviewSizes];
@@ -81,7 +81,7 @@ export const SizeSelector: React.FC = () => {
const {canvasContent} = useContext(Internals.CompositionManager);
const style = useMemo(() => {
return {
- padding: CONTROL_BUTTON_PADDING,
+ padding: CONTROL_BUTTON_PADDING - 2,
};
}, []);
@@ -139,6 +139,7 @@ export const SizeSelector: React.FC = () => {
return (
<div style={style} aria-label={accessibilityLabel}>
<Combobox
+ size="compact"
title={accessibilityLabel}
style={comboStyle}
selectedId={String(size.size)}
diff --git a/packages/studio/src/components/Timeline/TimelineAssetField.tsx b/packages/studio/src/components/Timeline/TimelineAssetField.tsx
index 27837f4e83..46428f5ee3 100644
--- a/packages/studio/src/components/Timeline/TimelineAssetField.tsx
+++ b/packages/studio/src/components/Timeline/TimelineAssetField.tsx
@@ -158,7 +158,7 @@ const TimelineStaticFileAssetField: React.FC<TimelineAssetFieldProps> = ({
return (
<Combobox
- small
+ size="small"
title={current}
selectedId={current}
values={items}
diff --git a/packages/studio/src/components/Timeline/TimelineEnumField.tsx b/packages/studio/src/components/Timeline/TimelineEnumField.tsx
index 92b715b92b..f82ebce494 100644
--- a/packages/studio/src/components/Timeline/TimelineEnumField.tsx
+++ b/packages/studio/src/components/Timeline/TimelineEnumField.tsx
@@ -66,7 +66,7 @@ export const TimelineEnumField: React.FC<{
return (
<Combobox
- small
+ size="small"
title={field.key}
selectedId={current}
values={items}
diff --git a/packages/studio/src/components/Timeline/TimelineFieldLabel.tsx b/packages/studio/src/components/Timeline/TimelineFieldLabel.tsx
index d1be50b9db..96deac61c4 100644
--- a/packages/studio/src/components/Timeline/TimelineFieldLabel.tsx
+++ b/packages/studio/src/components/Timeline/TimelineFieldLabel.tsx
@@ -25,15 +25,20 @@ export const TimelineFieldLabel: React.FC<{
readonly label: string;
readonly stacked?: boolean;
}> = ({rowDepth, selected, label, stacked = false}) => {
- const {basePadding} = useContext(TimelineRowLayoutContext);
+ const {basePadding, highlightSelectedLabel} = useContext(
+ TimelineRowLayoutContext,
+ );
const labelRowStyle = useMemo(
(): React.CSSProperties => ({
...getTimelineFieldLabelRowStyle(rowDepth, basePadding),
- ...getTimelineSelectedLabelStyle(selected, true),
+ ...getTimelineSelectedLabelStyle(
+ selected && highlightSelectedLabel,
+ true,
+ ),
...(stacked ? {flex: `0 0 ${SCHEMA_FIELD_ROW_HEIGHT}px`} : null),
alignSelf: 'stretch',
}),
- [basePadding, rowDepth, selected, stacked],
+ [basePadding, highlightSelectedLabel, rowDepth, selected, stacked],
);
const fieldNameStyle = useMemo(
diff --git a/packages/studio/src/components/Timeline/TimelineKeyframeControls.tsx b/packages/studio/src/components/Timeline/TimelineKeyframeControls.tsx
index c039d8e68c..159597db81 100644
--- a/packages/studio/src/components/Timeline/TimelineKeyframeControls.tsx
+++ b/packages/studio/src/components/Timeline/TimelineKeyframeControls.tsx
@@ -49,6 +49,10 @@ import {
} from './TimelineSelection';
import {canEditEasingForInterpolationFunction} from './update-selected-easing';
+const NAV_BUTTON_SIZE = 14;
+const INSPECTOR_NAV_BUTTON_WIDTH = NAV_BUTTON_SIZE / 2;
+const INSPECTOR_PREVIOUS_BUTTON_EXTRA_GAP = 1;
+
const controlsContainerStyle: React.CSSProperties = {
alignItems: 'center',
display: 'flex',
@@ -57,6 +61,14 @@ const controlsContainerStyle: React.CSSProperties = {
marginRight: 4,
};
+const inspectorControlsContainerStyle: React.CSSProperties = {
+ ...controlsContainerStyle,
+ paddingLeft:
+ NAV_BUTTON_SIZE -
+ INSPECTOR_NAV_BUTTON_WIDTH -
+ INSPECTOR_PREVIOUS_BUTTON_EXTRA_GAP,
+};
+
const navButtonStyle: React.CSSProperties = {
alignItems: 'center',
background: 'none',
@@ -65,13 +77,22 @@ const navButtonStyle: React.CSSProperties = {
cursor: 'pointer',
display: 'flex',
flexShrink: 0,
- height: 14,
+ height: NAV_BUTTON_SIZE,
justifyContent: 'center',
lineHeight: 1,
outline: 'none',
padding: 0,
userSelect: 'none',
- width: 14,
+ width: NAV_BUTTON_SIZE,
+};
+
+const inspectorNavButtonStyle: React.CSSProperties = {
+ width: INSPECTOR_NAV_BUTTON_WIDTH,
+};
+
+const inspectorPreviousNavButtonStyle: React.CSSProperties = {
+ ...inspectorNavButtonStyle,
+ marginRight: INSPECTOR_PREVIOUS_BUTTON_EXTRA_GAP,
};
const isKeyframedStatus = (
@@ -85,7 +106,7 @@ const diamondButtonStyle: React.CSSProperties = {
background: 'none',
};
-const svgStyle: React.CSSProperties = {display: 'block'};
+const svgStyle: React.CSSProperties = {display: 'block', flexShrink: 0};
type KeyframeControlTarget = {
readonly nodePathInfo: SequenceNodePathInfo;
@@ -751,21 +772,23 @@ export const TimelineKeyframeControls: React.FC<{
const previousStyle = useMemo(
(): React.CSSProperties => ({
...navButtonStyle,
+ ...(mode === 'inspector' ? inspectorPreviousNavButtonStyle : null),
cursor: previousDisabled ? 'default' : 'pointer',
opacity: previousDisabled ? 0.35 : 1,
visibility: showNavigationButtons ? 'visible' : 'hidden',
}),
- [previousDisabled, showNavigationButtons],
+ [mode, previousDisabled, showNavigationButtons],
);
const nextStyle = useMemo(
(): React.CSSProperties => ({
...navButtonStyle,
+ ...(mode === 'inspector' ? inspectorNavButtonStyle : null),
cursor: nextDisabled ? 'default' : 'pointer',
opacity: nextDisabled ? 0.35 : 1,
visibility: showNavigationButtons ? 'visible' : 'hidden',
}),
- [nextDisabled, showNavigationButtons],
+ [mode, nextDisabled, showNavigationButtons],
);
const diamondStyle = useMemo(
@@ -780,7 +803,13 @@ export const TimelineKeyframeControls: React.FC<{
const diamondColor = hasKeyframeAtCurrentFrame ? BLUE : LIGHT_TEXT;
return (
- <div style={controlsContainerStyle}>
+ <div
+ style={
+ mode === 'inspector'
+ ? inspectorControlsContainerStyle
+ : controlsContainerStyle
+ }
+ >
<button
type="button"
style={previousStyle}
diff --git a/packages/studio/src/components/Timeline/TimelineRowChrome.tsx b/packages/studio/src/components/Timeline/TimelineRowChrome.tsx
index 2b8ce92e54..898ca280e6 100644
--- a/packages/studio/src/components/Timeline/TimelineRowChrome.tsx
+++ b/packages/studio/src/components/Timeline/TimelineRowChrome.tsx
@@ -73,9 +73,12 @@ export const TimelineRowChrome: React.FC<{
onDoubleClick,
}) => {
const ref = useRef<HTMLDivElement>(null);
- const {basePadding, keyframeControlsPadding} = useContext(
- TimelineRowLayoutContext,
- );
+ const {
+ basePadding,
+ keyframeControlsPadding,
+ rowBorderRadius,
+ rowHorizontalMargin,
+ } = useContext(TimelineRowLayoutContext);
const indentWidth = getTimelineRowIndentWidth(depth);
useTimelineFocusableItem(selectionItem, ref);
@@ -132,8 +135,16 @@ export const TimelineRowChrome: React.FC<{
...rowBase,
...style,
backgroundColor: outerHeight === null ? highlightBackground : undefined,
+ borderRadius: rowBorderRadius,
+ margin: `0 ${rowHorizontalMargin}px`,
}),
- [style, outerHeight, highlightBackground],
+ [
+ style,
+ outerHeight,
+ highlightBackground,
+ rowBorderRadius,
+ rowHorizontalMargin,
+ ],
);
const outerStyle = useMemo((): React.CSSProperties | undefined => {
diff --git a/packages/studio/src/components/Timeline/TimelineRowLayoutContext.ts b/packages/studio/src/components/Timeline/TimelineRowLayoutContext.ts
index 3fff23090f..f647dfba3b 100644
--- a/packages/studio/src/components/Timeline/TimelineRowLayoutContext.ts
+++ b/packages/studio/src/components/Timeline/TimelineRowLayoutContext.ts
@@ -6,15 +6,24 @@ import {
type TimelineRowLayout = {
readonly basePadding: number;
+ readonly highlightSelectedLabel: boolean;
readonly keyframeControlsPadding: number;
+ readonly rowBorderRadius: number;
+ readonly rowHorizontalMargin: number;
};
export const INSPECTOR_TIMELINE_ROW_LAYOUT: TimelineRowLayout = {
basePadding: INSPECTOR_ROW_BASE_PADDING,
+ highlightSelectedLabel: false,
keyframeControlsPadding: 0,
+ rowBorderRadius: 4,
+ rowHorizontalMargin: 4,
};
export const TimelineRowLayoutContext = createContext<TimelineRowLayout>({
basePadding: TIMELINE_ROW_BASE_PADDING,
+ highlightSelectedLabel: true,
keyframeControlsPadding: TIMELINE_ROW_BASE_PADDING,
+ rowBorderRadius: 0,
+ rowHorizontalMargin: 0,
});
diff --git a/packages/studio/src/components/layout.tsx b/packages/studio/src/components/layout.tsx
index 271103bfdd..d4fb1de0dc 100644
--- a/packages/studio/src/components/layout.tsx
+++ b/packages/studio/src/components/layout.tsx
@@ -3,6 +3,7 @@ import React, {useMemo} from 'react';
export const SPACING_UNIT = 8;
export const COMPACT_CONTROL_ROW_HEIGHT = 28;
+export const COMPACT_INLINE_ROW_HEIGHT = 22;
export const Spacing: React.FC<{
readonly x?: number;
diff --git a/packages/studio/src/helpers/inject-css.ts b/packages/studio/src/helpers/inject-css.ts
index 423311a53d..6bb66130e5 100644
--- a/packages/studio/src/helpers/inject-css.ts
+++ b/packages/studio/src/helpers/inject-css.ts
@@ -97,12 +97,14 @@ const makeDefaultGlobalCSS = () => {
box-shadow: ${FOCUS_BOX_SHADOW};
}
- .__remotion-composition-selector-item:focus {
+ .__remotion-composition-selector-item:focus,
+ .__remotion-inspector-inline-action:focus {
outline: none;
box-shadow: none;
}
- .__remotion-composition-selector-item:focus-visible {
+ .__remotion-composition-selector-item:focus-visible,
+ .__remotion-inspector-inline-action:focus-visible {
box-shadow: ${FOCUS_BOX_SHADOW};
}
diff --git a/packages/studio/src/icons/scissors.tsx b/packages/studio/src/icons/scissors.tsx
index 526028828e..6d3808b145 100644
--- a/packages/studio/src/icons/scissors.tsx
+++ b/packages/studio/src/icons/scissors.tsx
@@ -10,7 +10,7 @@ export const ScissorsIcon: React.FC<
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" {...props}>
<path
fill={color}
- d="M112 32a80 80 0 1 0 0 160 80 80 0 1 0 0-160zm0-32c61.9 0 112 50.1 112 112 0 12.4-2 24.4-5.8 35.6L256 185.4 383.9 57.5c31-31 81.2-31 112.2 0 12.4 12.4 12.4 32.6 0 45L221.6 377c1.6 7.4 2.4 15.1 2.4 23 0 61.9-50.1 112-112 112S0 461.9 0 400s50.1-112 112-112c12.4 0 24.4 2 35.6 5.8L177.4 264 135 221.6c-7.4 1.6-15.1 2.4-23 2.4-61.9 0-112-50.1-112-112S50.1 0 112 0zm55.8 209.1l32.2 32.2 33.4-33.4-30.5-30.5c-9.3 12.9-21.3 23.7-35.1 31.7zm238.7-129-229 229c12.9 9.3 23.7 21.3 31.7 35.1L473.4 80c-18.5-18.4-48.4-18.3-66.9.1zM192 400a80 80 0 1 0-160 0 80 80 0 1 0 160 0zm206.5 39.9c18.5 18.5 48.4 18.5 66.9.1L346 320.6l22.6-22.6 119.5 119.5c12.4 12.4 12.4 32.6 0 45-31 31-81.2 31-112.2 0L290 376.6l22.6-22.6 85.9 85.9z"
+ d="M48 112a64 64 0 1 1 128 0 64 64 0 1 1 -128 0zm176 0C224 50.1 173.9 0 112 0S0 50.1 0 112 50.1 224 112 224c24 0 46.3-7.6 64.5-20.4l57.3 52.4-57.3 52.4C158.3 295.6 136 288 112 288 50.1 288 0 338.1 0 400s50.1 112 112 112 112-50.1 112-112c0-20.5-5.5-39.6-15.1-56.2L504.2 73.7c9.8-8.9 10.5-24.1 1.5-33.9s-24.1-10.5-33.9-1.5l-202.4 185.2-60.5-55.3c9.6-16.5 15.1-35.7 15.1-56.2zM471.8 473.7c9.8 8.9 25 8.3 33.9-1.5s8.3-25-1.5-33.9L338.6 286.8 302.7 319 471.8 473.7zM48 400a64 64 0 1 1 128 0 64 64 0 1 1 -128 0z"
/>
</svg>
);