🎥 Make videos programmatically with React
schema label
Jonny Burger705ce9d91f78
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/SchemaLabel.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/SchemaLabel.tsxindex a3a8f371ac..23cd454f29 100644--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/SchemaLabel.tsx+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/SchemaLabel.tsx@@ -2,7 +2,7 @@ import React from 'react';import {LIGHT_TEXT} from '../../../helpers/colors';import {Flex, Spacing} from '../../layout';import {InlineRemoveButton} from '../InlineRemoveButton';-import {label} from '../layout';+import {fieldsetLabel, label} from '../layout';import {getSchemaLabel} from './get-schema-label';import {SchemaResetButton} from './SchemaResetButton';import {SchemaSaveButton} from './SchemaSaveButton';@@ -65,3 +65,19 @@ export const SchemaLabel: React.FC<{</div>);};++export const SchemaFieldsetLabel: React.FC<{+ jsonPath: JSONPath;+ onRemove: null | (() => void);+}> = ({jsonPath, onRemove}) => {+ return (+ <legend style={fieldsetLabel}>+ {getSchemaLabel(jsonPath)}+ {onRemove ? (+ <>+ <Spacing x={1} /> <InlineRemoveButton onClick={onRemove} />+ </>+ ) : null}+ </legend>+ );+};diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.tsxindex 9167b63812..966bbc95f5 100644--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.tsx+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.tsx@@ -6,9 +6,8 @@ import {} from '../../../helpers/colors';import {Spacing} from '../../layout';import {ValidationMessage} from '../../NewComposition/ValidationMessage';-import {InlineRemoveButton} from '../InlineRemoveButton';-import {fieldsetLabel, optionRow} from '../layout';-import {getSchemaLabel} from './get-schema-label';+import {optionRow} from '../layout';+import {SchemaFieldsetLabel} from './SchemaLabel';import type {JSONPath} from './zod-types';import {ZodArrayItemEditor} from './ZodArrayItemEditor';@@ -109,25 +108,7 @@ export const ZodArrayEditor: React.FC<{<div style={fullWidth}><Element style={fieldset}>{isRoot ? null : (- <legend style={fieldsetLabel}>- {getSchemaLabel(jsonPath)}- {onRemove ? (- <>- <Spacing x={1} /> <InlineRemoveButton onClick={onRemove} />- </>- ) : null}-- {!localValue.zodValidation.success && (- <>- <Spacing x={1} />- <ValidationMessage- align="flex-end"- message={localValue.zodValidation.error.format()._errors[0]}- type="error"- />- </>- )}- </legend>+ <SchemaFieldsetLabel jsonPath={jsonPath} onRemove={onRemove} />)}<div style={isRoot ? undefined : container}>{localValue.value.map((child, i) => {@@ -148,6 +129,16 @@ export const ZodArrayEditor: React.FC<{);})}</div>+ {!localValue.zodValidation.success && (+ <>+ <Spacing x={1} />+ <ValidationMessage+ align="flex-end"+ message={localValue.zodValidation.error.format()._errors[0]}+ type="error"+ />+ </>+ )}</Element></div></div>diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.tsxindex 17413dda6c..1827339b16 100644--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.tsx+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.tsx@@ -1,10 +1,8 @@import React, {useMemo} from 'react';import {z} from 'remotion';import {INPUT_BORDER_COLOR_UNHOVERED} from '../../../helpers/colors';-import {Spacing} from '../../layout';-import {InlineRemoveButton} from '../InlineRemoveButton';-import {fieldsetLabel, optionRow} from '../layout';-import {getSchemaLabel} from './get-schema-label';+import {optionRow} from '../layout';+import {SchemaFieldsetLabel} from './SchemaLabel';import type {JSONPath} from './zod-types';import {ZodSwitch} from './ZodSwitch';@@ -73,14 +71,7 @@ export const ZodObjectEditor: React.FC<{<div style={fullWidth}><Element style={fieldset}>{isRoot ? null : (- <legend style={fieldsetLabel}>- {getSchemaLabel(jsonPath)}- {onRemove ? (- <>- <Spacing x={1} /> <InlineRemoveButton onClick={onRemove} />- </>- ) : null}- </legend>+ <SchemaFieldsetLabel jsonPath={jsonPath} onRemove={onRemove} />)}<div style={isRoot ? undefined : container}>{keys.map((key) => {