-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2308 from SpareBank1/develop_fiks-typerna-buttons…
…-storybook docs(ffe-buttons-react): fikser ts feil
- Loading branch information
Showing
9 changed files
with
186 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
import React from 'react'; | ||
import { ButtonGroup } from './ButtonGroup'; | ||
import { ActionButton } from './ActionButton'; | ||
import type { StoryObj, Meta } from '@storybook/react'; | ||
|
||
const meta: Meta<typeof ActionButton> = { | ||
const Custom: React.FC<React.ComponentProps<'a'>> = props => ( | ||
<a {...props}> | ||
{`Custom `} | ||
{props.children} | ||
</a> | ||
); | ||
|
||
const meta: Meta<typeof ActionButton<any>> = { | ||
title: 'components/buttons/ActionButton', | ||
component: ActionButton, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
as: { | ||
options: ['a', 'button', 'custom'], | ||
mapping: { | ||
'': 'a', | ||
a: 'a', | ||
button: 'button', | ||
custom: Custom, | ||
}, | ||
}, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof ActionButton>; | ||
type Story = StoryObj<typeof ActionButton<any>>; | ||
|
||
export const Standard: Story = { | ||
args: { | ||
ariaLabel: 'Actionknapp', | ||
as: 'button', | ||
ariaLoadingMessage: 'Vennligst vent...', | ||
isLoading: false, | ||
}, | ||
render: args => ( | ||
<ButtonGroup> | ||
<ActionButton {...args}>Actionknapp</ActionButton> | ||
</ButtonGroup> | ||
), | ||
render: args => <ActionButton {...args}>Actionknapp</ActionButton>, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
import React from 'react'; | ||
import { ButtonGroup } from './ButtonGroup'; | ||
import { PrimaryButton } from './PrimaryButton'; | ||
import type { StoryObj, Meta } from '@storybook/react'; | ||
|
||
const meta: Meta<typeof PrimaryButton> = { | ||
const Custom: React.FC<React.ComponentProps<'a'>> = props => ( | ||
<a {...props}> | ||
{`Custom `} | ||
{props.children} | ||
</a> | ||
); | ||
|
||
const meta: Meta<typeof PrimaryButton<any>> = { | ||
title: 'components/buttons/PrimaryButton', | ||
component: PrimaryButton, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
as: { | ||
options: ['a', 'button', 'custom'], | ||
mapping: { | ||
'': 'button', | ||
a: 'a', | ||
button: 'button', | ||
custom: Custom, | ||
}, | ||
}, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof PrimaryButton>; | ||
type Story = StoryObj<typeof PrimaryButton<any>>; | ||
|
||
export const Standard: Story = { | ||
args: { | ||
ariaLabel: 'Primærknapp', | ||
as: 'button', | ||
ariaLoadingMessage: 'Vennligst vent...', | ||
isLoading: false, | ||
}, | ||
render: args => ( | ||
<ButtonGroup> | ||
<PrimaryButton {...args}>Primærknapp</PrimaryButton> | ||
</ButtonGroup> | ||
), | ||
render: args => <PrimaryButton {...args}>Primærknapp</PrimaryButton>, | ||
}; |
31 changes: 22 additions & 9 deletions
31
packages/ffe-buttons-react/src/SecondaryButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
import React from 'react'; | ||
import { ButtonGroup } from './ButtonGroup'; | ||
import { SecondaryButton } from './SecondaryButton'; | ||
import type { StoryObj, Meta } from '@storybook/react'; | ||
|
||
const meta: Meta<typeof SecondaryButton> = { | ||
const Custom: React.FC<React.ComponentProps<'a'>> = props => ( | ||
<a {...props}> | ||
{`Custom `} | ||
{props.children} | ||
</a> | ||
); | ||
|
||
const meta: Meta<typeof SecondaryButton<any>> = { | ||
title: 'components/buttons/SecondaryButton', | ||
component: SecondaryButton, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
as: { | ||
options: ['a', 'button', 'custom'], | ||
mapping: { | ||
'': 'button', | ||
a: 'a', | ||
button: 'button', | ||
custom: Custom, | ||
}, | ||
}, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof SecondaryButton>; | ||
type Story = StoryObj<typeof SecondaryButton<any>>; | ||
|
||
export const Standard: Story = { | ||
args: { | ||
ariaLabel: 'Sekundærknapp', | ||
as: 'button', | ||
ariaLoadingMessage: 'Vennligst vent...', | ||
isLoading: false, | ||
}, | ||
render: args => ( | ||
<ButtonGroup> | ||
<SecondaryButton {...args}>Sekundærknapp</SecondaryButton> | ||
</ButtonGroup> | ||
), | ||
render: args => <SecondaryButton {...args}>Sekundærknapp</SecondaryButton>, | ||
}; |
33 changes: 22 additions & 11 deletions
33
packages/ffe-buttons-react/src/ShortcutButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
import React from 'react'; | ||
import { ButtonGroup } from './ButtonGroup'; | ||
import { ShortcutButton } from './ShortcutButton'; | ||
import type { StoryObj, Meta } from '@storybook/react'; | ||
|
||
const meta: Meta<typeof ShortcutButton> = { | ||
const Custom: React.FC<React.ComponentProps<'a'>> = props => ( | ||
<a {...props}> | ||
{`Custom `} | ||
{props.children} | ||
</a> | ||
); | ||
|
||
const meta: Meta<typeof ShortcutButton<any>> = { | ||
title: 'components/buttons/ShortcutButton', | ||
component: ShortcutButton, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
as: { | ||
options: ['a', 'button', 'custom'], | ||
mapping: { | ||
'': 'button', | ||
a: 'a', | ||
button: 'button', | ||
custom: Custom, | ||
}, | ||
}, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof ShortcutButton>; | ||
type Story = StoryObj<typeof ShortcutButton<any>>; | ||
|
||
export const Standard: Story = { | ||
args: { | ||
ariaLabel: 'Snarveiknapp', | ||
as: 'a', | ||
}, | ||
render: args => ( | ||
<ButtonGroup> | ||
<ShortcutButton {...args} as="a" href="#shortcutbutton"> | ||
Snarvei | ||
</ShortcutButton> | ||
</ButtonGroup> | ||
), | ||
render: args => <ShortcutButton {...args}>Snarvei</ShortcutButton>, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 22 additions & 11 deletions
33
packages/ffe-buttons-react/src/TertiaryButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
import React from 'react'; | ||
import { ButtonGroup } from './ButtonGroup'; | ||
import { TertiaryButton } from './TertiaryButton'; | ||
import type { StoryObj, Meta } from '@storybook/react'; | ||
|
||
const meta: Meta<typeof TertiaryButton> = { | ||
const Custom: React.FC<React.ComponentProps<'a'>> = props => ( | ||
<a {...props}> | ||
{`Custom `} | ||
{props.children} | ||
</a> | ||
); | ||
|
||
const meta: Meta<typeof TertiaryButton<any>> = { | ||
title: 'components/buttons/TertiaryButton', | ||
component: TertiaryButton, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
as: { | ||
options: ['a', 'button', 'custom'], | ||
mapping: { | ||
'': 'button', | ||
a: 'a', | ||
button: 'button', | ||
custom: Custom, | ||
}, | ||
}, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof TertiaryButton>; | ||
type Story = StoryObj<typeof TertiaryButton<any>>; | ||
|
||
export const Standard: Story = { | ||
args: { | ||
ariaLabel: 'Tertiærknapp', | ||
ariaLoadingMessage: 'Vennligst vent...', | ||
isLoading: false, | ||
as: 'button', | ||
}, | ||
render: args => ( | ||
<ButtonGroup> | ||
<TertiaryButton {...args}>Tertiærknapp</TertiaryButton> | ||
</ButtonGroup> | ||
), | ||
render: args => <TertiaryButton {...args}>Tertiærknapp</TertiaryButton>, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.svg' { | ||
const content: any; | ||
export default content; | ||
} |