import type { Meta, StoryObj } from '@storybook/react';
import { LazyErrorFallback } from './LazyErrorFallback';

const meta: Meta<typeof LazyErrorFallback> = {
  title: 'Components/UI/LazyComponent/LazyErrorFallback',
  component: LazyErrorFallback,
  tags: ['autodocs'],
  parameters: { layout: 'centered' },
  decorators: [
    (Story) => (
      <div className="min-h-layout-story w-full max-w-md">
        <Story />
      </div>
    ),
  ],
};

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

export const Default: Story = {
  args: {
    pageName: 'Dashboard',
    error: new Error('Failed to fetch chunk.'),
  },
};

export const WithRetry: Story = {
  args: {
    pageName: 'Settings',
    error: new Error('Network error.'),
    onRetry: () => {},
  },
};

export const NoError: Story = {
  args: {
    pageName: 'Profile',
  },
};
