-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathActionButton.stories.tsx
59 lines (54 loc) · 1.47 KB
/
ActionButton.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
import React from 'react';
import { ActionButton } from './ActionButton';
import type { StoryObj, Meta } from '@storybook/react';
const meta: Meta<typeof ActionButton<any>> = {
title: 'Komponenter/Buttons/ActionButton',
component: ActionButton,
parameters: {
docs: {
description: {
component:
'ActionButton er en knapp som brukes for å trigge en handling.',
},
},
},
argTypes: {
as: {
description: 'HTML-elementet som skal brukes',
options: ['button'],
mapping: {
'': 'button',
button: 'button',
},
},
isLoading: {
description: 'Viser en spinner når knappen laster',
control: 'boolean',
},
ariaLoadingMessage: {
description:
'Tekst som leses opp av skjermleser når knappen laster',
},
},
};
export default meta;
type Story = StoryObj<typeof ActionButton<any>>;
const buttonArgs = {
ariaLoadingMessage: 'Vennligst vent...',
isLoading: false,
};
export const Standard: Story = {
args: {
...buttonArgs,
as: 'button',
},
render: args => <ActionButton {...args}>Actionknapp</ActionButton>,
};
export const Loading: Story = {
args: {
...buttonArgs,
as: 'button',
isLoading: true,
},
render: args => <ActionButton {...args}>Laster inn...</ActionButton>,
};