-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(components): update arc icon button docs to align with new guida…
…nce (#351)
- Loading branch information
1 parent
fa1cbad
commit ffdf976
Showing
1 changed file
with
51 additions
and
56 deletions.
There are no files selected for viewing
107 changes: 51 additions & 56 deletions
107
packages/components/src/components/icon-button/arc-icon-button.stories.ts
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,68 +1,63 @@ | ||
import { Meta, Story } from '@storybook/web-components'; | ||
import { Meta, StoryFn } from '@storybook/web-components'; | ||
import { html } from 'lit'; | ||
import { ifDefined } from 'lit/directives/if-defined.js'; | ||
import type ArcIconButton from './ArcIconButton.js'; | ||
import ArcIconButton from './ArcIconButton'; | ||
import './arc-icon-button.js'; | ||
import '../ph-icon/rocket/ph-icon-rocket.js'; | ||
import '../ph-icon/link/ph-icon-link.js'; | ||
import '../ph-icon/download/ph-icon-download.js'; | ||
|
||
export default { | ||
title: 'Components/ArcIconButton', | ||
component: 'arc-icon-button', | ||
} as Meta; | ||
|
||
const Template: Story<ArcIconButton> = ({ | ||
name, | ||
label, | ||
href, | ||
target, | ||
download, | ||
active, | ||
disabled, | ||
loading, | ||
}) => html` | ||
title: 'Form/ArcIconButton', | ||
component: ArcIconButton.tag, | ||
argTypes: { | ||
disabled: { control: 'boolean' }, | ||
loading: { control: 'boolean' }, | ||
active: { table: { disable: true } }, | ||
href: { table: { disable: true } }, | ||
target: { table: { disable: true } }, | ||
download: { table: { disable: true } }, | ||
}, | ||
} satisfies Meta; | ||
|
||
export const Default: StoryFn<ArcIconButton> = ({ disabled, loading }) => html` | ||
<arc-icon-button | ||
label="${label}" | ||
href=${ifDefined(href || undefined)} | ||
target=${ifDefined(target || undefined)} | ||
download=${ifDefined(download || undefined)} | ||
?active="${active}" | ||
?disabled="${disabled}" | ||
?loading="${loading}" | ||
>${label}</arc-icon-button | ||
> | ||
<ph-icon-rocket slot="icon"></ph-icon-rocket> | ||
</arc-icon-button> | ||
`; | ||
|
||
const defaultArgs = { | ||
label: 'Icon button', | ||
href: '', | ||
target: '', | ||
download: '', | ||
active: false, | ||
disabled: false, | ||
loading: false, | ||
}; | ||
|
||
/* TYPES */ | ||
export const Default = Template.bind({}); | ||
Default.args = { ...defaultArgs }; | ||
|
||
export const Link = Template.bind({}); | ||
Link.args = { ...defaultArgs, href: '/' }; | ||
|
||
export const LinkNewWindow = Template.bind({}); | ||
LinkNewWindow.args = { ...Link.args, target: '_blank' }; | ||
|
||
export const LinkDownload = Template.bind({}); | ||
LinkDownload.args = { ...Link.args, download: 'ARC Storybook' }; | ||
|
||
export const LinkDisabled = Template.bind({}); | ||
LinkDisabled.args = { ...Link.args, disabled: true }; | ||
|
||
/* STATES */ | ||
export const Active = Template.bind({}); | ||
Active.args = { ...defaultArgs, active: true }; | ||
export const Labaled: StoryFn<ArcIconButton> = ({ disabled, loading }) => html` | ||
<arc-icon-button | ||
?disabled="${disabled}" | ||
?loading="${loading}" | ||
> | ||
<ph-icon-rocket slot="icon"></ph-icon-rocket> | ||
<span>Rocket</span> | ||
</arc-icon-button> | ||
`; | ||
|
||
export const Disabled = Template.bind({}); | ||
Disabled.args = { ...defaultArgs, disabled: true }; | ||
export const Link: StoryFn<ArcIconButton> = ({ disabled, loading }) => html` | ||
<arc-icon-button | ||
href="https://arc.arup.com" | ||
target="_blank" | ||
rel="noopener" | ||
?disabled="${disabled}" | ||
?loading="${loading}" | ||
> | ||
<ph-icon-link slot="icon"></ph-icon-link> | ||
<span>Link</span> | ||
</arc-icon-button> | ||
`; | ||
|
||
export const Loading = Template.bind({}); | ||
Loading.args = { ...defaultArgs, loading: true }; | ||
export const Download: StoryFn<ArcIconButton> = ({ disabled, loading }) => html` | ||
<arc-icon-button | ||
download="file.txt" | ||
?disabled="${disabled}" | ||
?loading="${loading}" | ||
> | ||
<ph-icon-download slot="icon"></ph-icon-download> | ||
<span>Download</span> | ||
</arc-icon-button> | ||
`; |