2022-03-08 11:50:34 +01:00
|
|
|
import { Meta, Story } from "@storybook/angular";
|
|
|
|
|
2022-09-27 11:25:53 +02:00
|
|
|
import { ButtonComponent } from "./button.component";
|
2022-03-08 11:50:34 +01:00
|
|
|
|
|
|
|
export default {
|
2022-06-17 16:23:04 +02:00
|
|
|
title: "Component Library/Button",
|
2022-09-27 11:25:53 +02:00
|
|
|
component: ButtonComponent,
|
2022-03-08 11:50:34 +01:00
|
|
|
args: {
|
|
|
|
buttonType: "primary",
|
2022-09-27 11:25:53 +02:00
|
|
|
disabled: false,
|
|
|
|
loading: false,
|
2022-03-08 11:50:34 +01:00
|
|
|
},
|
2022-04-08 17:47:32 +02:00
|
|
|
parameters: {
|
|
|
|
design: {
|
|
|
|
type: "figma",
|
2022-10-24 19:20:38 +02:00
|
|
|
url: "https://www.figma.com/file/Zt3YSeb6E6lebAffrNLa0h/Tailwind-Component-Library?node-id=5115%3A26950",
|
2022-04-08 17:47:32 +02:00
|
|
|
},
|
|
|
|
},
|
2022-03-08 11:50:34 +01:00
|
|
|
} as Meta;
|
|
|
|
|
2022-09-27 11:25:53 +02:00
|
|
|
const Template: Story<ButtonComponent> = (args: ButtonComponent) => ({
|
2022-03-08 11:50:34 +01:00
|
|
|
props: args,
|
2022-03-11 21:00:24 +01:00
|
|
|
template: `
|
2022-09-27 11:25:53 +02:00
|
|
|
<button bitButton [disabled]="disabled" [loading]="loading" [buttonType]="buttonType" [block]="block">Button</button>
|
|
|
|
<a bitButton [disabled]="disabled" [loading]="loading" [buttonType]="buttonType" [block]="block" href="#" class="tw-ml-2">Link</a>
|
2022-03-11 21:00:24 +01:00
|
|
|
`,
|
2022-03-08 11:50:34 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
export const Primary = Template.bind({});
|
|
|
|
Primary.args = {
|
|
|
|
buttonType: "primary",
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Secondary = Template.bind({});
|
|
|
|
Secondary.args = {
|
|
|
|
buttonType: "secondary",
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Danger = Template.bind({});
|
|
|
|
Danger.args = {
|
|
|
|
buttonType: "danger",
|
|
|
|
};
|
|
|
|
|
2022-09-27 11:25:53 +02:00
|
|
|
const AllStylesTemplate: Story = (args) => ({
|
2022-03-08 11:50:34 +01:00
|
|
|
props: args,
|
|
|
|
template: `
|
2022-09-27 11:25:53 +02:00
|
|
|
<button bitButton [disabled]="disabled" [loading]="loading" [block]="block" buttonType="primary" class="tw-mr-2">Primary</button>
|
|
|
|
<button bitButton [disabled]="disabled" [loading]="loading" [block]="block" buttonType="secondary" class="tw-mr-2">Secondary</button>
|
|
|
|
<button bitButton [disabled]="disabled" [loading]="loading" [block]="block" buttonType="danger" class="tw-mr-2">Danger</button>
|
2022-03-08 11:50:34 +01:00
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2022-09-27 11:25:53 +02:00
|
|
|
export const Loading = AllStylesTemplate.bind({});
|
|
|
|
Loading.args = {
|
|
|
|
disabled: false,
|
|
|
|
loading: true,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Disabled = AllStylesTemplate.bind({});
|
2022-03-08 11:50:34 +01:00
|
|
|
Disabled.args = {
|
2022-09-27 11:25:53 +02:00
|
|
|
disabled: true,
|
|
|
|
loading: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
const DisabledWithAttributeTemplate: Story = (args) => ({
|
|
|
|
props: args,
|
|
|
|
template: `
|
|
|
|
<ng-container *ngIf="disabled">
|
|
|
|
<button bitButton disabled [loading]="loading" [block]="block" buttonType="primary" class="tw-mr-2">Primary</button>
|
|
|
|
<button bitButton disabled [loading]="loading" [block]="block" buttonType="secondary" class="tw-mr-2">Secondary</button>
|
|
|
|
<button bitButton disabled [loading]="loading" [block]="block" buttonType="danger" class="tw-mr-2">Danger</button>
|
|
|
|
</ng-container>
|
|
|
|
<ng-container *ngIf="!disabled">
|
|
|
|
<button bitButton [loading]="loading" [block]="block" buttonType="primary" class="tw-mr-2">Primary</button>
|
|
|
|
<button bitButton [loading]="loading" [block]="block" buttonType="secondary" class="tw-mr-2">Secondary</button>
|
|
|
|
<button bitButton [loading]="loading" [block]="block" buttonType="danger" class="tw-mr-2">Danger</button>
|
|
|
|
</ng-container>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
|
|
|
export const DisabledWithAttribute = DisabledWithAttributeTemplate.bind({});
|
|
|
|
DisabledWithAttribute.args = {
|
|
|
|
disabled: true,
|
|
|
|
loading: false,
|
2022-03-08 11:50:34 +01:00
|
|
|
};
|
2022-09-16 11:30:41 +02:00
|
|
|
|
2022-09-27 11:25:53 +02:00
|
|
|
const BlockTemplate: Story<ButtonComponent> = (args: ButtonComponent) => ({
|
2022-09-16 11:30:41 +02:00
|
|
|
props: args,
|
|
|
|
template: `
|
|
|
|
<span class="tw-flex">
|
|
|
|
<button bitButton [buttonType]="buttonType" [block]="block">[block]="true" Button</button>
|
|
|
|
<a bitButton [buttonType]="buttonType" [block]="block" href="#" class="tw-ml-2">[block]="true" Link</a>
|
|
|
|
|
|
|
|
<button bitButton [buttonType]="buttonType" block class="tw-ml-2">block Button</button>
|
|
|
|
<a bitButton [buttonType]="buttonType" block href="#" class="tw-ml-2">block Link</a>
|
|
|
|
</span>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
|
|
|
export const Block = BlockTemplate.bind({});
|
|
|
|
Block.args = {
|
|
|
|
block: true,
|
|
|
|
};
|