import { Meta, StoryObj } from "@storybook/react"; import { getCssProps } from "@sb/cssprops"; import { SpinnerLoader } from "../SpinnerLoader"; import { LoadingStatus } from "."; import { Text } from "@components/Typography/Text"; const meta: Meta = { title: "Feedback/LoadingStatus", component: LoadingStatus, tags: ["!autodocs"], parameters: { cssprops: getCssProps("Loader"), }, argTypes: { loadingMessage: { type: "string", }, error: { type: "string", }, }, }; export default meta; type Story = StoryObj; export const Primary: Story = { args: { isLoading: true, loadingMessage: "Loading...", error: "", children: "This is the content", }, }; export const Error: Story = { args: { isLoading: false, loadingMessage: "", error: "An error occurred", children: "This is the content", }, }; export const CustomizeLoadingState: Story = { args: { isLoading: true, loadingMessage: "Loading...", error: "", children: "This is the content", renderLoading: , }, }; export const CustomizeErrorState: Story = { args: { isLoading: false, loadingMessage: "", error: "An error occurred", children: "This is the content", renderError: ( Error! ), }, }; export const WithData: Story = { args: { children: (data: any) => {data}, data: "This is the data!", }, parameters: { docs: { source: { code: ` {(data) => {data}} `, }, }, }, }; export const NoDataFallback: Story = { args: { data: null, children: (data: any) => {data}, fallback: ( No data available ), }, parameters: { docs: { source: { code: ` No data available}> {(data) => {data}} `, }, }, }, };