Skip to content

Commit 0e5d4f7

Browse files
authored
experimental: Allow styling staggering and text animations (#5135)
## Description 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent f6d859c commit 0e5d4f7

File tree

8 files changed

+23
-3
lines changed

8 files changed

+23
-3
lines changed

fixtures/webstudio-features/app/__generated__/[animations]._index.tsx

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fixtures/webstudio-features/app/__generated__/[text-duration]._index.tsx

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fixtures/webstudio-features/app/__generated__/index.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/sdk-components-animation/src/animate-text.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ type AnimateChildrenProps = {
4040
* Defines how the text is split for animation (e.g., by character, space, or symbol).
4141
*/
4242
splitBy?: keyof typeof split;
43+
} & {
44+
className?: string;
4345
};
4446

4547
export const AnimateText = forwardRef<ElementRef<"div">, AnimateChildrenProps>(

packages/sdk-components-animation/src/animate-text.ws.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { TextAnimationIcon } from "@webstudio-is/icons/svg";
22
import type { WsComponentMeta, WsComponentPropsMeta } from "@webstudio-is/sdk";
33
import { animation } from "./shared/meta";
44
import { props } from "./__generated__/animate-text.props";
5+
import { div } from "@webstudio-is/sdk/normalize.css";
56

67
export const meta: WsComponentMeta = {
78
category: "animations",
@@ -18,6 +19,9 @@ export const meta: WsComponentMeta = {
1819
text: false,
1920
},
2021
],
22+
presetStyle: {
23+
div,
24+
},
2125
};
2226

2327
export const propsMeta: WsComponentPropsMeta = {

packages/sdk-components-animation/src/stagger-animation.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ type StaggerAnimationProps = {
2929
* Text content to animate.
3030
*/
3131
children: React.ReactNode;
32+
} & {
33+
className?: string;
3234
};
3335

3436
export const StaggerAnimation = forwardRef<

packages/sdk-components-animation/src/stagger-animation.ws.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { StaggerAnimationIcon } from "@webstudio-is/icons/svg";
22
import type { WsComponentMeta, WsComponentPropsMeta } from "@webstudio-is/sdk";
33
import { animation } from "./shared/meta";
44
import { props } from "./__generated__/stagger-animation.props";
5+
import { div } from "@webstudio-is/sdk/normalize.css";
56

67
export const meta: WsComponentMeta = {
78
category: "animations",
@@ -18,6 +19,9 @@ export const meta: WsComponentMeta = {
1819
text: false,
1920
},
2021
],
22+
presetStyle: {
23+
div,
24+
},
2125
};
2226

2327
export const propsMeta: WsComponentPropsMeta = {

0 commit comments

Comments
 (0)