import { faker } from "@faker-js/faker" import { Meta, StoryObj } from "@storybook/react" import React, { useState } from "react" import { numberFormatter } from "../../utils" import { Button } from "../Button" import { Flex } from "../Flex" import { ChangeAnimation, type ChangeAnimationProps } from "./ChangeAnimation" type Story = StoryObj const meta: Meta = { title: "Design System/ChangeAnimation", component: ChangeAnimation, args: { onChangeAnimationClassName: "animate-change-animation-bg", onPositiveChangeAnimationClassName: "animate-positive-change-bg", onNegativeChangeAnimationClassName: "animate-negative-change-bg", display: "compact", }, } export default meta const generateFakeNumber = () => faker.number.float({ max: 100, fractionDigits: 4 }) const format = numberFormatter("en-US") const Template = (args: Omit) => { const [value, setValue] = useState(generateFakeNumber()) const formatted = format(value, { display: args.display }) return ( <> {formatted} ) } export const Default: Story = { render: Template, } const MinorChange = (args: Omit) => { const [value, setValue] = useState(10.924) const formatted = format(value, { display: args.display }) return ( <> Raw Value: {value} {formatted} ) } export const minorChange: Story = { render: MinorChange, }