Skip to content

🎥 Make videos programmatically with React

compact number editor

Jonny Burgerefc164b3c816
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx
index 751a5e6b49..e5433d1319 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx
@@ -1,4 +1,4 @@
-import React, {useCallback, useState} from 'react';
+import React, {useCallback, useMemo, useState} from 'react';
import type {z} from 'remotion';
import {Spacing} from '../../layout';
import {RemotionInput} from '../../NewComposition/RemInput';
@@ -20,7 +20,8 @@ export const ZodNumberEditor: React.FC<{
jsonPath: JSONPath;
value: number;
setValue: React.Dispatch<React.SetStateAction<number>>;
-}> = ({jsonPath, value, schema, setValue}) => {
+ compact: boolean;
+}> = ({jsonPath, value, schema, setValue, compact}) => {
const [localValue, setLocalValue] = useState<LocalState>(() => {
return {
value: String(value),
@@ -43,8 +44,16 @@ export const ZodNumberEditor: React.FC<{
[schema, setValue]
);
+ const style = useMemo(() => {
+ if (compact) {
+ return {...optionRow, paddingLeft: 0, paddingRight: 0};
+ }
+
+ return optionRow;
+ }, [compact]);
+
return (
- <div style={optionRow}>
+ <div style={style}>
<div style={label}>{jsonPath[jsonPath.length - 1]}</div>
<div style={fullWidth}>
<RemotionInput
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx
index 059b5bdd34..81f8bd28b0 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodSwitch.tsx
@@ -53,6 +53,7 @@ export const ZodSwitch: React.FC<{
setValue={setValue as React.Dispatch<React.SetStateAction<unknown>>}
jsonPath={jsonPath}
schema={schema}
+ compact={compact}
/>
);
}