2022-09-15 07:38:29 +02:00
|
|
|
import { Meta, Story } from "@storybook/angular";
|
|
|
|
|
2022-10-10 16:04:29 +02:00
|
|
|
import { BitIconButtonComponent, IconButtonType } from "./icon-button.component";
|
|
|
|
|
|
|
|
const buttonTypes: IconButtonType[] = [
|
|
|
|
"contrast",
|
|
|
|
"main",
|
|
|
|
"muted",
|
|
|
|
"primary",
|
|
|
|
"secondary",
|
|
|
|
"danger",
|
|
|
|
];
|
2022-09-15 07:38:29 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
title: "Component Library/Icon Button",
|
|
|
|
component: BitIconButtonComponent,
|
|
|
|
args: {
|
|
|
|
bitIconButton: "bwi-plus",
|
|
|
|
size: "default",
|
|
|
|
disabled: false,
|
|
|
|
},
|
2022-10-10 16:04:29 +02:00
|
|
|
argTypes: {
|
|
|
|
buttonTypes: { table: { disable: true } },
|
|
|
|
},
|
2022-09-15 07:38:29 +02:00
|
|
|
} as Meta;
|
|
|
|
|
|
|
|
const Template: Story<BitIconButtonComponent> = (args: BitIconButtonComponent) => ({
|
2022-10-10 16:04:29 +02:00
|
|
|
props: { ...args, buttonTypes },
|
2022-09-15 07:38:29 +02:00
|
|
|
template: `
|
2022-10-10 16:04:29 +02:00
|
|
|
<table class="tw-border-spacing-2 tw-text-center tw-text-main">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td *ngFor="let buttonType of buttonTypes" class="tw-capitalize tw-font-bold tw-p-4"
|
|
|
|
[class.tw-text-contrast]="buttonType === 'contrast'"
|
|
|
|
[class.tw-bg-primary-500]="buttonType === 'contrast'">{{buttonType}}</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2022-09-15 07:38:29 +02:00
|
|
|
|
2022-10-10 16:04:29 +02:00
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="tw-font-bold tw-p-4 tw-text-left">Default</td>
|
|
|
|
<td *ngFor="let buttonType of buttonTypes" class="tw-p-2" [class.tw-bg-primary-500]="buttonType === 'contrast'">
|
|
|
|
<button
|
|
|
|
[bitIconButton]="bitIconButton"
|
|
|
|
[buttonType]="buttonType"
|
|
|
|
[size]="size"
|
|
|
|
title="Example icon button"
|
|
|
|
aria-label="Example icon button"></button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2022-09-15 07:38:29 +02:00
|
|
|
|
2022-10-10 16:04:29 +02:00
|
|
|
<tr>
|
|
|
|
<td class="tw-font-bold tw-p-4 tw-text-left">Disabled</td>
|
|
|
|
<td *ngFor="let buttonType of buttonTypes" class="tw-p-2" [class.tw-bg-primary-500]="buttonType === 'contrast'">
|
|
|
|
<button
|
|
|
|
[bitIconButton]="bitIconButton"
|
|
|
|
[buttonType]="buttonType"
|
|
|
|
[size]="size"
|
|
|
|
disabled
|
|
|
|
title="Example icon button"
|
|
|
|
aria-label="Example icon button"></button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2022-09-15 07:38:29 +02:00
|
|
|
|
2022-10-10 16:04:29 +02:00
|
|
|
<tr>
|
|
|
|
<td class="tw-font-bold tw-p-4 tw-text-left">Loading</td>
|
|
|
|
<td *ngFor="let buttonType of buttonTypes" class="tw-p-2" [class.tw-bg-primary-500]="buttonType === 'contrast'">
|
|
|
|
<button
|
|
|
|
[bitIconButton]="bitIconButton"
|
|
|
|
[buttonType]="buttonType"
|
|
|
|
[size]="size"
|
|
|
|
loading="true"
|
|
|
|
title="Example icon button"
|
|
|
|
aria-label="Example icon button"></button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
`,
|
|
|
|
});
|
2022-09-15 07:38:29 +02:00
|
|
|
|
2022-10-10 16:04:29 +02:00
|
|
|
export const Default = Template.bind({});
|
|
|
|
Default.args = {
|
|
|
|
size: "default",
|
2022-09-15 07:38:29 +02:00
|
|
|
};
|
|
|
|
|
2022-10-10 16:04:29 +02:00
|
|
|
export const Small = Template.bind({});
|
|
|
|
Small.args = {
|
|
|
|
size: "small",
|
2022-09-15 07:38:29 +02:00
|
|
|
};
|