import KFEmpty, { EmptyType } from '@/components/KFEmpty';
import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
const meta = {
  title: 'Components/KFEmpty 空状态',
  component: KFEmpty,
  parameters: {
    // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
    // layout: 'centered',
  },
  // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
  tags: ['autodocs'],
  // More on argTypes: https://storybook.js.org/docs/api/argtypes
  argTypes: {
    type: { control: 'radio', options: Object.values(EmptyType) },
  },
  // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
  args: { onButtonClick: fn() },
} satisfies Meta<typeof KFEmpty>;

export default meta;
type Story = StoryObj<typeof meta>;

// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
export const Developing: Story = {
  args: {
    type: EmptyType.Developing,
    title: '敬请期待~',
    content: '很抱歉，您访问的正在开发中，\n请耐心等待。',
    hasFooter: true,
    buttonTitle: '返回首页',
  },
};

export const NoData: Story = {
  args: {
    type: EmptyType.NoData,
    title: '暂无数据',
    content: '很抱歉，没有搜索到您想要的内容\n建议刷新试试',
    hasFooter: true,
  },
};

export const NotFound: Story = {
  args: {
    type: EmptyType.NotFound,
    title: '404',
    content: '很抱歉，您访问的页面地址有误，\n或者该页面不存在。',
    hasFooter: true,
    buttonTitle: '返回首页',
  },
};
