Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

experimental: Move animation name Input title (#5043)

Ivan Starkovcbe06f1bfe0c
diff --git a/apps/builder/app/builder/features/settings-panel/props-section/animation/animation-panel-content.tsx b/apps/builder/app/builder/features/settings-panel/props-section/animation/animation-panel-content.tsx
index 8c98b4d8d2..36810ffa9a 100644
--- a/apps/builder/app/builder/features/settings-panel/props-section/animation/animation-panel-content.tsx
+++ b/apps/builder/app/builder/features/settings-panel/props-section/animation/animation-panel-content.tsx
@@ -3,6 +3,7 @@ import {
Box,
Flex,
Grid,
+ InputField,
Label,
Select,
theme,
@@ -34,16 +35,6 @@ import {
import { Keyframes } from "./animation-keyframes";
import { humanizeString } from "~/shared/string-utils";
-type Props = {
- type: "scroll" | "view";
- value: ScrollAnimation | ViewAnimation;
- onChange: ((
- value: ScrollAnimation | ViewAnimation,
- isEphemeral: boolean
- ) => void) &
- ((value: undefined, isEphemeral: true) => void);
-};
-
const fillModeDescriptions: Record<
NonNullable<ViewAnimation["timing"]["fill"]>,
string
@@ -213,7 +204,22 @@ const EasingInput = ({
);
};
-export const AnimationPanelContent = ({ onChange, value, type }: Props) => {
+type AnimationPanelContentProps = {
+ type: "scroll" | "view";
+ value: ScrollAnimation | ViewAnimation;
+
+ onChange: ((
+ value: ScrollAnimation | ViewAnimation,
+ isEphemeral: boolean
+ ) => void) &
+ ((value: undefined, isEphemeral: true) => void);
+};
+
+export const AnimationPanelContent = ({
+ onChange,
+ value,
+ type,
+}: AnimationPanelContentProps) => {
const fieldIds = useIds([
"rangeStartName",
"rangeStartValue",
@@ -221,6 +227,7 @@ export const AnimationPanelContent = ({ onChange, value, type }: Props) => {
"rangeEndValue",
"fill",
"easing",
+ "name",
] as const);
const timelineRangeDescriptions =
@@ -256,20 +263,53 @@ export const AnimationPanelContent = ({ onChange, value, type }: Props) => {
direction="column"
css={{
maxHeight: "60dvh",
- paddingBottom: theme.panel.paddingBlock,
+
+ paddingBlock: theme.panel.paddingBlock,
}}
>
+ <Grid
+ gap={1}
+ align={"center"}
+ css={{
+ paddingInline: theme.panel.paddingInline,
+ gridTemplateColumns: "1fr",
+ flexShrink: 0,
+ }}
+ >
+ <Label htmlFor={fieldIds.name}>Name</Label>
+ <InputField
+ id={fieldIds.name}
+ css={{
+ width: "100%",
+ fontWeight: `inherit`,
+ }}
+ value={value.name}
+ placeholder="Enter animation name"
+ onChange={(event) => {
+ const name = event.currentTarget.value;
+
+ const newValue = {
+ ...value,
+ name,
+ };
+
+ handleChange(newValue, false);
+ }}
+ />
+ </Grid>
+
<Grid
gap={1}
align={"center"}
css={{
gridTemplateColumns: "1fr 1fr",
- padding: theme.panel.padding,
+ paddingInline: theme.panel.paddingInline,
flexShrink: 0,
}}
>
<Label htmlFor={fieldIds.fill}>Fill Mode</Label>
<Label htmlFor={fieldIds.easing}>Easing</Label>
+
<Select
id={fieldIds.fill}
options={fillModeNames}
@@ -344,8 +384,8 @@ export const AnimationPanelContent = ({ onChange, value, type }: Props) => {
gap={1}
align={"center"}
css={{
- gridTemplateColumns: "2fr 1fr",
- padding: theme.panel.padding,
+ gridTemplateColumns: "1fr 1fr",
+ paddingInline: theme.panel.paddingInline,
flexShrink: 0,
}}
>
diff --git a/apps/builder/app/builder/features/settings-panel/props-section/animation/animations-select.tsx b/apps/builder/app/builder/features/settings-panel/props-section/animation/animations-select.tsx
index 57ce8e4aba..ad07b651ab 100644
--- a/apps/builder/app/builder/features/settings-panel/props-section/animation/animations-select.tsx
+++ b/apps/builder/app/builder/features/settings-panel/props-section/animation/animations-select.tsx
@@ -16,7 +16,6 @@ import {
useSortable,
CssValueListArrowFocus,
FloatingPanel,
- InputField,
DialogTitle,
Tooltip,
SectionTitleButton,
@@ -175,28 +174,7 @@ export const AnimationsSelect = ({
key={index}
title={
<DialogTitle css={{ paddingLeft: theme.spacing[6] }}>
- <InputField
- css={{
- width: "100%",
- fontWeight: `inherit`,
- }}
- variant="chromeless"
- value={animation.name}
- autoFocus={true}
- placeholder="Enter animation name"
- onChange={(event) => {
- const name = event.currentTarget.value;
- const newAnimations = [...value.animations];
- newAnimations[index] = { ...animation, name };
-
- const newValue = {
- ...value,
- animations: newAnimations,
- };
-
- handleChange(newValue, false);
- }}
- />
+ {animation.name}
</DialogTitle>
}
content={