Skip to content

🎥 Make videos programmatically with React

right align inputs

Jonny Burger1c19e8ee419c
diff --git a/packages/cli/src/editor/components/NewComposition/InputDragger.tsx b/packages/cli/src/editor/components/NewComposition/InputDragger.tsx
index 43eba34a8f..4ba541567d 100644
--- a/packages/cli/src/editor/components/NewComposition/InputDragger.tsx
+++ b/packages/cli/src/editor/components/NewComposition/InputDragger.tsx
@@ -16,6 +16,7 @@ type Props = InputHTMLAttributes<HTMLInputElement> & {
onTextChange: (newVal: string) => void;
status: RemInputStatus;
formatter?: (str: number | string) => string;
+ rightAlign: boolean;
};
export const InputDragger: React.FC<Props> = ({
@@ -27,6 +28,7 @@ export const InputDragger: React.FC<Props> = ({
onTextChange,
formatter = (q) => String(q),
status,
+ rightAlign,
...props
}) => {
const [inputFallback, setInputFallback] = useState(false);
@@ -162,6 +164,7 @@ export const InputDragger: React.FC<Props> = ({
defaultValue={value}
status={status}
pattern={'[0-9]*[.]?[0-9]*'}
+ rightAlign={rightAlign}
{...props}
/>
</HigherZIndex>
diff --git a/packages/cli/src/editor/components/NewComposition/NewCompDuration.tsx b/packages/cli/src/editor/components/NewComposition/NewCompDuration.tsx
index dd0e08648c..3f6a060ecb 100644
--- a/packages/cli/src/editor/components/NewComposition/NewCompDuration.tsx
+++ b/packages/cli/src/editor/components/NewComposition/NewCompDuration.tsx
@@ -45,6 +45,7 @@ export const NewCompDuration: React.FC<{
// Hitting Promise.all() limit in Chrome
max={300_000}
onValueChange={onDurationChangedDirectly}
+ rightAlign={false}
/>
{compDurationErrMessage ? (
<>
diff --git a/packages/cli/src/editor/components/NewComposition/NewComposition.tsx b/packages/cli/src/editor/components/NewComposition/NewComposition.tsx
index cb73e14d33..c6d768c97a 100644
--- a/packages/cli/src/editor/components/NewComposition/NewComposition.tsx
+++ b/packages/cli/src/editor/components/NewComposition/NewComposition.tsx
@@ -270,6 +270,7 @@ const NewComposition: React.FC<{initialCompType: CompType}> = (props) => {
type="text"
placeholder="Composition name"
status="ok"
+ rightAlign={false}
/>
{compNameErrMessage ? (
<>
@@ -305,6 +306,7 @@ const NewComposition: React.FC<{initialCompType: CompType}> = (props) => {
formatter={(w) => `${w}px`}
max={100000000}
onValueChange={onWidthDirectlyChanged}
+ rightAlign={false}
/>
{compWidthErrMessage ? (
<>
@@ -340,6 +342,7 @@ const NewComposition: React.FC<{initialCompType: CompType}> = (props) => {
status="ok"
max={100000000}
onValueChange={onHeightDirectlyChanged}
+ rightAlign={false}
/>
{compHeightErrMessage ? (
<>
diff --git a/packages/cli/src/editor/components/NewComposition/RemInput.tsx b/packages/cli/src/editor/components/NewComposition/RemInput.tsx
index c94255fc2b..352214294d 100644
--- a/packages/cli/src/editor/components/NewComposition/RemInput.tsx
+++ b/packages/cli/src/editor/components/NewComposition/RemInput.tsx
@@ -24,6 +24,7 @@ type Props = React.DetailedHTMLProps<
HTMLInputElement
> & {
status: RemInputStatus;
+ rightAlign: boolean;
};
export const INPUT_HORIZONTAL_PADDING = 8;
@@ -72,15 +73,16 @@ const RemInputForwardRef: React.ForwardRefRenderFunction<
const inputRef = useRef<HTMLInputElement>(null);
const {tabIndex} = useZIndex();
- const style = useMemo(() => {
+ const style = useMemo((): React.CSSProperties => {
return {
backgroundColor: INPUT_BACKGROUND,
...inputBaseStyle,
width: '100%',
borderColor: getInputBorderColor({isFocused, isHovered, status}),
+ textAlign: props.rightAlign ? 'right' : 'left',
...(props.style ?? {}),
};
- }, [isFocused, isHovered, props.style, status]);
+ }, [isFocused, isHovered, props.rightAlign, props.style, status]);
useImperativeHandle(
ref,
diff --git a/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherContent.tsx b/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherContent.tsx
index 2285ed6ac0..d6cd997506 100644
--- a/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherContent.tsx
+++ b/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherContent.tsx
@@ -388,6 +388,7 @@ export const QuickSwitcherContent: React.FC<{
value={state.query}
onChange={onTextChange}
placeholder="Search compositions..."
+ rightAlign={false}
/>
{showKeyboardShortcuts ? (
<>
diff --git a/packages/cli/src/editor/components/RenderModal/EnvInput.tsx b/packages/cli/src/editor/components/RenderModal/EnvInput.tsx
index dcea65932c..3c8a7f18ab 100644
--- a/packages/cli/src/editor/components/RenderModal/EnvInput.tsx
+++ b/packages/cli/src/editor/components/RenderModal/EnvInput.tsx
@@ -98,6 +98,7 @@ export const EnvInput: React.FC<{
onBlur={makeKeyWarningEligible}
autoFocus={autoFocus}
onChange={handleKeyChange}
+ rightAlign={false}
/>
<Spacing x={1} />
<RemotionInput
@@ -108,6 +109,7 @@ export const EnvInput: React.FC<{
value={envVal}
onBlur={makeValueWarningEligible}
onChange={handleValueChange}
+ rightAlign={false}
/>
<Spacing x={1.5} />
<InlineEyeButton enabled={!showInPlainText} onClick={togglePlainText} />
diff --git a/packages/cli/src/editor/components/RenderModal/FrameRangeSetting.tsx b/packages/cli/src/editor/components/RenderModal/FrameRangeSetting.tsx
index 34ef8d0107..c8b6068742 100644
--- a/packages/cli/src/editor/components/RenderModal/FrameRangeSetting.tsx
+++ b/packages/cli/src/editor/components/RenderModal/FrameRangeSetting.tsx
@@ -81,6 +81,7 @@ export const FrameRangeSetting: React.FC<{
min={minStartFrame}
max={maxStartFrame}
status="ok"
+ rightAlign
/>
</RightAlignInput>
<RightAlignInput>
@@ -94,6 +95,7 @@ export const FrameRangeSetting: React.FC<{
min={minEndFrame}
max={maxEndFrame}
status="ok"
+ rightAlign
/>
</RightAlignInput>
</div>
diff --git a/packages/cli/src/editor/components/RenderModal/NumberOfLoopsSetting.tsx b/packages/cli/src/editor/components/RenderModal/NumberOfLoopsSetting.tsx
index 48fa754f9a..b38ef3412e 100644
--- a/packages/cli/src/editor/components/RenderModal/NumberOfLoopsSetting.tsx
+++ b/packages/cli/src/editor/components/RenderModal/NumberOfLoopsSetting.tsx
@@ -45,6 +45,7 @@ export const NumberOfLoopsSetting: React.FC<{
step={1}
min={min}
status="ok"
+ rightAlign
/>
</RightAlignInput>
</div>
diff --git a/packages/cli/src/editor/components/RenderModal/NumberSetting.tsx b/packages/cli/src/editor/components/RenderModal/NumberSetting.tsx
index cb9217d72f..1ebaa96527 100644
--- a/packages/cli/src/editor/components/RenderModal/NumberSetting.tsx
+++ b/packages/cli/src/editor/components/RenderModal/NumberSetting.tsx
@@ -66,6 +66,7 @@ export const NumberSetting: React.FC<{
max={max}
formatter={formatter}
status="ok"
+ rightAlign
/>
</RightAlignInput>
</div>
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalAudio.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalAudio.tsx
index 0d7e1872e3..5b8ddafd67 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModalAudio.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModalAudio.tsx
@@ -148,6 +148,7 @@ export const RenderModalAudio: React.FC<{
value={customTargetAudioBitrate}
onChange={onTargetAudioBitrateChanged}
status="ok"
+ rightAlign
/>
</div>
</div>
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalBasic.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalBasic.tsx
index dbe01b04f8..f40736027a 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModalBasic.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModalBasic.tsx
@@ -170,6 +170,7 @@ export const RenderModalBasic: React.FC<{
min={0}
status="ok"
max={currentComposition.durationInFrames - 1}
+ rightAlign
/>
</RightAlignInput>
</div>
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalInput.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalInput.tsx
index 6e94623382..3c9500debb 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModalInput.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModalInput.tsx
@@ -34,6 +34,7 @@ export function RenderModalInput({
type="text"
value={outName}
onChange={onValueChange}
+ rightAlign
/>
{validationMessage ? (
<>
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalPicture.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalPicture.tsx
index 35203258ce..30513b64b8 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModalPicture.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModalPicture.tsx
@@ -165,6 +165,7 @@ export const RenderModalPicture: React.FC<{
value={customTargetVideoBitrate}
onChange={onTargetVideoBitrateChanged}
status="ok"
+ rightAlign
/>
</div>
</div>
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodColorEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodColorEditor.tsx
index a60d2741b6..d1609afcb0 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodColorEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodColorEditor.tsx
@@ -191,6 +191,7 @@ export const ZodColorEditor: React.FC<{
status={status}
placeholder={jsonPath.join('.')}
onChange={onTextChange}
+ rightAlign={false}
/>
<Spacing x={1} />
<InputDragger
@@ -202,6 +203,7 @@ export const ZodColorEditor: React.FC<{
max={100}
step={1}
formatter={(v) => `${Math.round(Number(v))}%`}
+ rightAlign={false}
/>
</Row>
{!localValue.zodValidation.success && (
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodDateEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodDateEditor.tsx
index 7c9c3ca9b7..26eb93a076 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodDateEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodDateEditor.tsx
@@ -131,6 +131,7 @@ export const ZodDateEditor: React.FC<{
placeholder={jsonPath.join('.')}
onChange={onChange}
style={inputStyle}
+ rightAlign={false}
/>
<Spacing y={1} block />
<div style={explainer}>Date is in local format</div>
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx
index 3023fc267e..4a17d68b6c 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.tsx
@@ -163,6 +163,7 @@ export const ZodNumberEditor: React.FC<{
min={getMinValue(schema)}
max={getMaxValue(schema)}
step={getStep(schema)}
+ rightAlign={false}
/>
{!localValue.zodValidation.success && (
<>
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStringEditor.tsx b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStringEditor.tsx
index 87cd63cf9d..e14bd4eac7 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStringEditor.tsx
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/ZodStringEditor.tsx
@@ -91,6 +91,7 @@ export const ZodStringEditor: React.FC<{
status={localValue.zodValidation.success ? 'ok' : 'error'}
placeholder={jsonPath.join('.')}
onChange={onChange}
+ rightAlign={false}
/>
{!localValue.zodValidation.success && (
<>
diff --git a/packages/cli/src/editor/components/RenderModal/layout.ts b/packages/cli/src/editor/components/RenderModal/layout.ts
index c71e5340a1..6a590e66c2 100644
--- a/packages/cli/src/editor/components/RenderModal/layout.ts
+++ b/packages/cli/src/editor/components/RenderModal/layout.ts
@@ -34,7 +34,6 @@ export const rightRow: React.CSSProperties = {
export const input: React.CSSProperties = {
minWidth: 250,
- textAlign: 'right',
};
export const fieldsetLabel: React.CSSProperties = {