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

import HOMEPAGE_SHORTCUT_JSON from '@/__fixtures__/homepage_shortcuts.json';
import Playbar from '@/components/playbar/Playbar';
import { ShortcutRowSection } from '@/components/shortcuts/ShortcutRowSection';
import { components } from '@/lib/gen';

type PagePropsAndCustomArgs = React.ComponentProps<typeof ShortcutRowSection>;

const meta: Meta<PagePropsAndCustomArgs> = {
  title: 'components/shortcut/ShortcutRowSection',
  component: ShortcutRowSection,
};

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

const shortcutItem = HOMEPAGE_SHORTCUT_JSON
  .sections[0] as components['schemas']['ShortcutSectionSchema'];

export const Default: Story = {
  render(args) {
    return (
      <>
        <ShortcutRowSection {...args} />
        <Playbar />
      </>
    );
  },
  args: {
    title: shortcutItem.title,
    items: shortcutItem.items,
  },
};
