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

/**
 * 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) => {
  return (
    <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>,
};