Skip to content

🎥 Make videos programmatically with React

layout fixes and improving on random observations

Jonny Burger28609d8b8906
diff --git a/packages/cli/src/editor/components/RenderModal/CliCopyButton.tsx b/packages/cli/src/editor/components/RenderModal/CliCopyButton.tsx
index 9f83f9346d..b5025ba2e1 100644
--- a/packages/cli/src/editor/components/RenderModal/CliCopyButton.tsx
+++ b/packages/cli/src/editor/components/RenderModal/CliCopyButton.tsx
@@ -20,6 +20,9 @@ const buttonStyle: React.CSSProperties = {
height: '30px',
border: 'none',
cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
};
export const CliCopyButton: React.FC<{valueToCopy: string}> = ({
diff --git a/packages/cli/src/editor/components/RenderModal/InfoBubble.tsx b/packages/cli/src/editor/components/RenderModal/InfoBubble.tsx
index e01d2f9191..75c5c94cac 100644
--- a/packages/cli/src/editor/components/RenderModal/InfoBubble.tsx
+++ b/packages/cli/src/editor/components/RenderModal/InfoBubble.tsx
@@ -1,7 +1,7 @@
import {PlayerInternals} from '@remotion/player';
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import ReactDOM from 'react-dom';
-import {LIGHT_TEXT} from '../../helpers/colors';
+import {INPUT_BACKGROUND, LIGHT_TEXT} from '../../helpers/colors';
import {HigherZIndex, useZIndex} from '../../state/z-index';
import {getPortal} from '../Menu/portals';
import {outerPortal} from '../Menu/styles';
@@ -120,6 +120,7 @@ export const InfoBubble: React.FC<{
display: 'inline-flex',
flexDirection: 'row',
alignItems: 'center',
+ padding: 6,
};
}, []);
@@ -144,7 +145,12 @@ export const InfoBubble: React.FC<{
<div style={outerPortal} className="css-reset">
<HigherZIndex onOutsideClick={onHide} onEscape={onHide}>
<div style={portalStyle}>
- <InfoTooltip arrowDirection={layout}>{children}</InfoTooltip>
+ <InfoTooltip
+ backgroundColor={INPUT_BACKGROUND}
+ arrowDirection={layout}
+ >
+ {children}
+ </InfoTooltip>
</div>
</HigherZIndex>
</div>,
diff --git a/packages/cli/src/editor/components/RenderModal/InfoTooltip.tsx b/packages/cli/src/editor/components/RenderModal/InfoTooltip.tsx
index 74f690a7e9..a8bd62889f 100644
--- a/packages/cli/src/editor/components/RenderModal/InfoTooltip.tsx
+++ b/packages/cli/src/editor/components/RenderModal/InfoTooltip.tsx
@@ -1,5 +1,5 @@
import React, {useMemo} from 'react';
-import {BACKGROUND, BORDER_COLOR, INPUT_BACKGROUND} from '../../helpers/colors';
+import {BORDER_COLOR} from '../../helpers/colors';
import {VERTICAL_SCROLLBAR_CLASSNAME} from '../Menu/is-menu-item';
import {SHADOW_TOWARDS_BOTTOM, SHADOW_TOWARDS_TOP} from '../Menu/styles';
@@ -17,25 +17,26 @@ const arrowUp: React.CSSProperties = {
const arrowDown: React.CSSProperties = {
...arrow,
- marginTop: -0.5,
+ marginTop: -1,
};
export const InfoTooltip: React.FC<{
children: React.ReactNode;
arrowDirection: 'up' | 'down';
-}> = ({children, arrowDirection}) => {
+ backgroundColor: string;
+}> = ({children, arrowDirection, backgroundColor}) => {
const container: React.CSSProperties = useMemo(() => {
return {
boxShadow:
arrowDirection === 'down' ? SHADOW_TOWARDS_TOP : SHADOW_TOWARDS_BOTTOM,
- background: BACKGROUND,
+ background: backgroundColor,
color: 'white',
border: '0.5px solid ' + BORDER_COLOR,
maxHeight: 200,
overflow: 'auto',
borderRadius: '4px',
};
- }, [arrowDirection]);
+ }, [arrowDirection, backgroundColor]);
return (
<div
style={{
@@ -51,7 +52,7 @@ export const InfoTooltip: React.FC<{
<svg viewBox="0 0 14 7" style={arrowDown}>
<path
d={`M 14 0 L 7 7 L 0 0`}
- fill={INPUT_BACKGROUND}
+ fill={backgroundColor}
strokeLinecap="butt"
stroke={BORDER_COLOR}
strokeWidth={0.5}
@@ -62,7 +63,7 @@ export const InfoTooltip: React.FC<{
<svg viewBox="0 0 14 7" style={arrowUp}>
<path
d={`M 0 7 L 7 0 L 14 7`}
- fill={INPUT_BACKGROUND}
+ fill={backgroundColor}
strokeLinecap="butt"
stroke={BORDER_COLOR}
strokeWidth={0.5}
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.tsx
index c0ef0ea974..54f150db3b 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.tsx
@@ -15,8 +15,11 @@ const fullWidth: React.CSSProperties = {
};
const stackTrace: React.CSSProperties = {
- fontSize: '14px',
- padding: '10px',
+ padding: 10,
+};
+
+const stackTraceLabel: React.CSSProperties = {
+ fontSize: 14,
};
const legend: React.CSSProperties = {
@@ -102,8 +105,17 @@ export const ZodEffectEditor: React.FC<{
type="error"
/>
<Spacing x={0.5} />
- <InfoBubble title="Stack Trace">
- <div style={stackTrace}>Zod Validation has failed!</div>
+ <InfoBubble title="Zod validation failure">
+ <div style={stackTrace}>
+ <div style={stackTraceLabel}>Zod Validation has failed:</div>
+ {localValue.zodValidation.error.errors.map((error, index) => (
+ // eslint-disable-next-line react/no-array-index-key
+ <div key={index} style={stackTraceLabel}>
+ Type: {error.code} <br />
+ Message: {error.message}
+ </div>
+ ))}
+ </div>
</InfoBubble>
<Spacing x={0.5} />
</legend>
diff --git a/packages/cli/src/editor/components/RenderModal/layout.ts b/packages/cli/src/editor/components/RenderModal/layout.ts
index 6a590e66c2..ece5823fff 100644
--- a/packages/cli/src/editor/components/RenderModal/layout.ts
+++ b/packages/cli/src/editor/components/RenderModal/layout.ts
@@ -22,6 +22,9 @@ export const label: React.CSSProperties = {
lineHeight: '40px',
color: LIGHT_TEXT,
fontFamily: 'sans-serif',
+ display: 'flex',
+ flexDirection: 'row',
+ alignItems: 'center',
};
export const rightRow: React.CSSProperties = {
diff --git a/packages/renderer/src/options/video-codec.tsx b/packages/renderer/src/options/video-codec.tsx
index f1023ba495..7841649cbb 100644
--- a/packages/renderer/src/options/video-codec.tsx
+++ b/packages/renderer/src/options/video-codec.tsx
@@ -5,9 +5,9 @@ export const videoCodecOption: RemotionOption = {
cliFlag: '--codec',
description: (
<>
- Remotion supports 5 video codecs: h264 (default), h265, vp8, vp9 and
- prores. While H264 will work well in most cases, sometimes it&apos;s worth
- going for a different codec. Follow the link below for an overview.
+ H264 works well in most cases, sometimes it&apos;s worth going for a
+ different codec. WebM achieves higher compression but is slower to render.
+ WebM and ProRes support transparency.
</>
),
ssrName: 'codec',