-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathButtonGroup.stories.tsx
80 lines (74 loc) · 2.05 KB
/
ButtonGroup.stories.tsx
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
72
73
74
75
76
77
78
79
80
import React from 'react';
import { ButtonGroup } from './ButtonGroup';
import { PrimaryButton } from './PrimaryButton';
import { SecondaryButton } from './SecondaryButton';
import { TertiaryButton } from './TertiaryButton';
import type { StoryObj, Meta } from '@storybook/react';
const meta: Meta<typeof ButtonGroup> = {
title: 'Komponenter/Buttons/ButtonGroup',
component: ButtonGroup,
parameters: {
docs: {
description: {
component:
'ButtonGroup brukes for å gruppere relaterte knapper sammen. Den sørger for riktig spacing mellom knappene og korrekt visuell presentasjon.',
},
},
},
argTypes: {
thin: {
description: 'Reduserer avstanden mellom knappene',
control: 'boolean',
},
ariaLabel: {
description: 'Beskrivende tekst for skjermlesere',
control: 'text',
},
},
};
export default meta;
type Story = StoryObj<typeof ButtonGroup>;
const groupArgs = {
ariaLabel: 'Knappegruppe',
thin: false,
};
export const Standard: Story = {
args: {
...groupArgs,
},
render: args => (
<ButtonGroup {...args}>
<SecondaryButton>Forrige</SecondaryButton>
<PrimaryButton>Neste</PrimaryButton>
<TertiaryButton>Avbryt</TertiaryButton>
</ButtonGroup>
),
};
export const ThinSpacing: Story = {
args: {
...groupArgs,
thin: true,
},
render: args => (
<ButtonGroup {...args}>
<SecondaryButton>Nei</SecondaryButton>
<PrimaryButton>Ja</PrimaryButton>
</ButtonGroup>
),
};
export const WithLoadingState: Story = {
args: {
...groupArgs,
},
render: args => (
<ButtonGroup {...args}>
<SecondaryButton>Tilbake</SecondaryButton>
<PrimaryButton
isLoading={true}
ariaLoadingMessage="Sender inn skjema"
>
Send inn
</PrimaryButton>
</ButtonGroup>
),
};