aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/meta-list/meta-list.stories.tsx
blob: d73c5b948ec7f731000a54bea61e4d08dde4f473 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import type { ComponentMeta, ComponentStory } from '@storybook/react';
import { Link } from '../../atoms';
import { MetaItem } from './meta-item';
import { MetaList } from './meta-list';

/**
 * MetaList - Storybook Meta
 */
export default {
  title: 'Molecules/MetaList',
  component: MetaList,
  argTypes: {
    items: {
      description: 'The meta items.',
      type: {
        name: 'object',
        required: true,
        value: {},
      },
    },
  },
} as ComponentMeta<typeof MetaList>;

const Template: ComponentStory<typeof MetaList> = (args) => (
  <MetaList {...args} />
);

const items = [
  { id: 'comments', label: 'Comments', value: 'No comments.' },
  {
    id: 'category',
    label: 'Category',
    value: <Link href="#cat1">Cat 1</Link>,
  },
  {
    id: 'tags',
    label: 'Tags',
    value: [
      { id: 'tag1', value: <Link href="#tag1">Tag 1</Link> },
      { id: 'tag2', value: <Link href="#tag2">Tag 2</Link> },
    ],
  },
  {
    hasBorderedValues: true,
    hasInlinedValues: true,
    id: 'technologies',
    label: 'Technologies',
    value: [
      { id: 'techno1', value: 'HTML' },
      { id: 'techno2', value: 'CSS' },
      { id: 'techno3', value: 'Javascript' },
    ],
  },
];

/**
 * MetaList Stories - Default
 */
export const Default = Template.bind({});
Default.args = {
  children: items.map(({ id, ...item }) => <MetaItem key={id} {...item} />),
};

/**
 * MetaList Stories - Inlined
 */
export const Inlined = Template.bind({});
Inlined.args = {
  children: items.map(({ id, ...item }) => <MetaItem key={id} {...item} />),
  isInline: true,
};