Skip to content

Commit 8fb598d

Browse files
committed
Add AnimateText component
1 parent 5b7d2c7 commit 8fb598d

File tree

9 files changed

+84
-3
lines changed

9 files changed

+84
-3
lines changed

packages/sdk-components-animation/src/__generated__/animate-children.props.ts

Lines changed: 10 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/__generated__/animate-text.props.ts

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { forwardRef, type ElementRef } from "react";
2+
3+
const easings = {
4+
linear: true,
5+
easeIn: true,
6+
easeInCubic: true,
7+
easeInQuart: true,
8+
easeOut: true,
9+
easeOutCubic: true,
10+
easeOutQuart: true,
11+
ease: true,
12+
easeInOutCubic: true,
13+
easeInOutQuart: true,
14+
};
15+
16+
type AnimateChildrenProps = {
17+
charWindow: number;
18+
easing: keyof typeof easings;
19+
children: React.ReactNode;
20+
};
21+
22+
export const AnimateText = forwardRef<ElementRef<"div">, AnimateChildrenProps>(
23+
({ charWindow: _, easing: __, ...props }, ref) => {
24+
return <div ref={ref} {...props} />;
25+
}
26+
);
27+
28+
const displayName = "AnimateText";
29+
AnimateText.displayName = displayName;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { TextIcon } from "@webstudio-is/icons/svg";
2+
import type { WsComponentMeta, WsComponentPropsMeta } from "@webstudio-is/sdk";
3+
import { props } from "./__generated__/animate-text.props";
4+
5+
export const meta: WsComponentMeta = {
6+
category: "general",
7+
type: "container",
8+
description: "Animate Text",
9+
icon: TextIcon,
10+
order: 6,
11+
label: "Animate Text",
12+
};
13+
14+
export const propsMeta: WsComponentPropsMeta = {
15+
props,
16+
initialProps: ["charWindow", "easing"],
17+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { AnimateChildren } from "./animate-children";
2+
export { AnimateText } from "./animate-text";
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export { meta as AnimateChildren } from "./scroll.ws";
1+
export { meta as AnimateChildren } from "./animate-children.ws";
2+
export { meta as AnimateText } from "./animate-text.ws";
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export { propsMeta as AnimateChildren } from "./scroll.ws";
1+
export { propsMeta as AnimateChildren } from "./animate-children.ws";
2+
export { propsMeta as AnimateText } from "./animate-text.ws";

0 commit comments

Comments
 (0)