aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/fieldset/fieldset.stories.tsx
blob: a7d665d2d5640c373e69b42d3e433d7d3588cb77 (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
import type { ComponentMeta, ComponentStory } from '@storybook/react';
import { Input } from '../fields';
import { Legend } from '../legend';
import { Fieldset as FieldsetComponent } from './fieldset';

/**
 * Fieldset - Storybook Meta
 */
export default {
  title: 'Atoms/Forms',
  component: FieldsetComponent,
  args: {
    isDisabled: false,
  },
  argTypes: {
    isDisabled: {
      control: {
        type: 'boolean',
      },
      description:
        'Define if the fields inside the fieldset should be disabled.',
      table: {
        category: 'Options',
        defaultValue: { summary: false },
      },
      type: {
        name: 'boolean',
        required: false,
      },
    },
  },
} as ComponentMeta<typeof FieldsetComponent>;

const Template: ComponentStory<typeof FieldsetComponent> = (args) => (
  <FieldsetComponent {...args}>
    <div>
      <Input
        aria-label="A field example"
        id="field1"
        name="field1"
        type="text"
      />
    </div>
    <div>
      <Input
        aria-label="Another field example"
        id="field2"
        name="field2"
        type="text"
      />
    </div>
  </FieldsetComponent>
);

/**
 * Fieldset Story
 */
export const Fieldset = Template.bind({});
Fieldset.args = {
  legend: <Legend>The fieldset legend</Legend>,
};