|
| 1 | +import AnimatedFollowButton from "@/animata/button/animated-follow-button"; |
| 2 | +import { Meta, StoryObj } from "@storybook/react"; |
| 3 | + |
| 4 | +const meta: Meta<typeof AnimatedFollowButton> = { |
| 5 | + title: "Button/Animated Follow Button", |
| 6 | + component: AnimatedFollowButton, |
| 7 | + parameters: { layout: "centered" }, |
| 8 | + argTypes: { |
| 9 | + initialText: { control: "text" }, |
| 10 | + changeText: { control: "text" }, |
| 11 | + className: { control: "text" }, |
| 12 | + changeTextClassName: { control: "text" }, |
| 13 | + }, |
| 14 | +}; |
| 15 | + |
| 16 | +export default meta; |
| 17 | +type Story = StoryObj<typeof meta>; |
| 18 | + |
| 19 | +export const Primary: Story = { |
| 20 | + args: { |
| 21 | + initialText: "Follow", |
| 22 | + changeText: "Following!", |
| 23 | + className: "h-16 bg-green-100 text-green-700 flex rounded-full items-center justify-center", |
| 24 | + changeTextClassName: |
| 25 | + "h-16 bg-green-700 text-green-100 rounded-full text-white flex items-center justify-center", |
| 26 | + }, |
| 27 | + render: (args) => ( |
| 28 | + <div className="flex h-40 items-center justify-center"> |
| 29 | + <AnimatedFollowButton {...args} /> |
| 30 | + </div> |
| 31 | + ), |
| 32 | +}; |
| 33 | + |
| 34 | +export const DifferentAnimations: Story = { |
| 35 | + args: {}, |
| 36 | + render: () => { |
| 37 | + const buttons = [ |
| 38 | + { |
| 39 | + initialText: "Default", |
| 40 | + changeText: "Up To Down", |
| 41 | + animationType: "up-to-down" as const, |
| 42 | + color: "blue", |
| 43 | + }, |
| 44 | + { |
| 45 | + initialText: "Click Me", |
| 46 | + changeText: "Down To Up", |
| 47 | + animationType: "down-to-up" as const, |
| 48 | + color: "zinc", |
| 49 | + }, |
| 50 | + { |
| 51 | + initialText: "Click Me", |
| 52 | + changeText: "Zoom In", |
| 53 | + animationType: "zoom-in" as const, |
| 54 | + color: "red", |
| 55 | + }, |
| 56 | + ]; |
| 57 | + |
| 58 | + return ( |
| 59 | + <div className="grid h-60 w-full grid-cols-3 items-center justify-center gap-6"> |
| 60 | + {buttons.map(({ initialText, changeText, animationType, color }, idx) => ( |
| 61 | + <AnimatedFollowButton |
| 62 | + key={idx} |
| 63 | + className={`flex h-16 items-center justify-center rounded-xl bg-${color}-100 text-${color}-600`} |
| 64 | + changeTextClassName={`h-16 bg-${color}-600 text-${color}-100 rounded-xl text-white flex items-center justify-center`} |
| 65 | + initialText={<span className="inline-flex items-center">{initialText}</span>} |
| 66 | + changeText={<span className="inline-flex items-center">{changeText}</span>} |
| 67 | + animationType={animationType} |
| 68 | + /> |
| 69 | + ))} |
| 70 | + </div> |
| 71 | + ); |
| 72 | + }, |
| 73 | +}; |
0 commit comments