Skip to content

🎥 Make videos programmatically with React

warning

Jonny Burgeref7920c868e3
diff --git a/packages/cli/src/editor/components/NewComposition/RemInput.tsx b/packages/cli/src/editor/components/NewComposition/RemInput.tsx
index 7a56b0d43d..dc363c444f 100644
--- a/packages/cli/src/editor/components/NewComposition/RemInput.tsx
+++ b/packages/cli/src/editor/components/NewComposition/RemInput.tsx
@@ -11,13 +11,16 @@ import {
INPUT_BORDER_COLOR_HOVERED,
INPUT_BORDER_COLOR_UNHOVERED,
SELECTED_BACKGROUND,
+ WARNING_COLOR,
} from '../../helpers/colors';
import {useZIndex} from '../../state/z-index';
type Props = React.DetailedHTMLProps<
React.InputHTMLAttributes<HTMLInputElement>,
HTMLInputElement
->;
+> & {
+ warning?: boolean;
+};
export const inputBaseStyle: React.CSSProperties = {
padding: '8px 10px',
@@ -41,14 +44,16 @@ const RemInputForwardRef: React.ForwardRefRenderFunction<
backgroundColor: INPUT_BACKGROUND,
...inputBaseStyle,
width: '100%',
- borderColor: isFocused
+ borderColor: props.warning
+ ? WARNING_COLOR
+ : isFocused
? SELECTED_BACKGROUND
: isHovered
? INPUT_BORDER_COLOR_HOVERED
: INPUT_BORDER_COLOR_UNHOVERED,
...(props.style ?? {}),
};
- }, [isFocused, isHovered, props.style]);
+ }, [isFocused, isHovered, props.style, props.warning]);
useImperativeHandle(
ref,
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModal.tsx b/packages/cli/src/editor/components/RenderModal/RenderModal.tsx
index 859fa7c3f7..53e68b15d1 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModal.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModal.tsx
@@ -18,6 +18,7 @@ import {ModalContainer} from '../ModalContainer';
import {NewCompHeader} from '../ModalHeader';
import {InputDragger} from '../NewComposition/InputDragger';
import {RemotionInput} from '../NewComposition/RemInput';
+import {ValidationMessage} from '../NewComposition/ValidationMessage';
import {addStillRenderJob} from '../RenderQueue/actions';
import {leftSidebarTabs} from '../SidebarContent';
@@ -74,15 +75,17 @@ const container: React.CSSProperties = {
padding: 20,
};
-const row: React.CSSProperties = {
+const optionRow: React.CSSProperties = {
display: 'flex',
flexDirection: 'row',
- alignItems: 'center',
+ alignItems: 'flex-start',
+ minHeight: 40,
};
const label: React.CSSProperties = {
width: 150,
fontSize: 14,
+ lineHeight: '40px',
};
const rightRow: React.CSSProperties = {
@@ -249,7 +252,7 @@ export const RenderModal: React.FC<{composition: TCompMetadata}> = ({
<ModalContainer onOutsideClick={onQuit} onEscape={onQuit}>
<NewCompHeader title={`Render ${composition.id}`} />
<div style={container}>
- <div style={row}>
+ <div style={optionRow}>
<div style={label}>Format</div>
<div style={rightRow}>
<button type="button" onClick={setPng}>
@@ -263,7 +266,7 @@ export const RenderModal: React.FC<{composition: TCompMetadata}> = ({
{imageFormat === 'jpeg' && (
<>
<Spacing block y={0.5} />
- <div style={row}>
+ <div style={optionRow}>
<div style={label}>Quality</div>
<div style={rightRow}>
<InputDragger
@@ -281,7 +284,7 @@ export const RenderModal: React.FC<{composition: TCompMetadata}> = ({
</>
)}
<Spacing block y={0.5} />
- <div style={row}>
+ <div style={optionRow}>
<div style={label}>Scale</div>
<div style={rightRow}>
<InputDragger
@@ -299,18 +302,24 @@ export const RenderModal: React.FC<{composition: TCompMetadata}> = ({
</div>
</div>
<Spacing block y={0.5} />
- <div style={row}>
+ <div style={optionRow}>
<div style={label}>Output name</div>
<div style={rightRow}>
- <RemotionInput
- style={input}
- type="text"
- value={outName}
- onChange={onValueChange}
- />
+ <div>
+ <RemotionInput
+ // TODO: Validate and reject folders or weird file names
+ warning={existence}
+ style={input}
+ type="text"
+ value={outName}
+ onChange={onValueChange}
+ />
+ {existence ? (
+ <ValidationMessage message="Will be overwritten" />
+ ) : null}
+ </div>
</div>
</div>
- <div>Exists: {String(existence)}</div>
<Spacing block y={0.5} />
<div style={buttonRow}>
<Button onClick={onClick} disabled={state.type === 'load'}>
diff --git a/packages/cli/src/editor/helpers/colors.ts b/packages/cli/src/editor/helpers/colors.ts
index cecb0b52c5..95f463a5db 100644
--- a/packages/cli/src/editor/helpers/colors.ts
+++ b/packages/cli/src/editor/helpers/colors.ts
@@ -10,6 +10,7 @@ export const INPUT_BORDER_COLOR_UNHOVERED = 'rgba(0, 0, 0, 0.6)';
export const INPUT_BORDER_COLOR_HOVERED = 'rgba(255, 255, 255, 0.05)';
export const TIMELINE_BACKGROUND = '#111';
export const FAIL_COLOR = '#ff3232';
+export const WARNING_COLOR = '#f1c40f';
export const getBackgroundFromHoverState = ({
selected,