summaryrefslogtreecommitdiffstats
path: root/src/components/molecules/nav/breadcrumb.stories.tsx
blob: d2836194e2f9692269a2639195aa96bffa4133e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { IntlProvider } from 'react-intl';
import BreadcrumbComponent, { type BreadcrumbItem } from './breadcrumb';

export default {
  title: 'Molecules/Nav',
  component: BreadcrumbComponent,
  argTypes: {
    className: {
      control: {
        type: 'text',
      },
      table: {
        category: 'Styles',
      },
      description: 'Set additional classnames to the nav element.',
      type: {
        name: 'string',
        required: false,
      },
    },
    items: {
      description: 'The breadcrumb items.',
      type: {
        name: 'object',
        required: true,
        value: {},
      },
    },
  },
} as ComponentMeta<typeof BreadcrumbComponent>;

const Template: ComponentStory<typeof BreadcrumbComponent> = (args) => (
  <IntlProvider locale="en">
    <BreadcrumbComponent {...args} />
  </IntlProvider>
);

const items: BreadcrumbItem[] = [
  { id: 'home', url: '#', name: 'Home' },
  { id: 'blog', url: '#', name: 'Blog' },
  { id: 'post1', url: '#', name: 'A Post' },
];

export const Breadcrumb = Template.bind({});
Breadcrumb.args = {
  items,
};