bitwarden-estensione-browser/libs/components/src/button/button.stories.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
2.0 KiB
TypeScript
Raw Normal View History

2022-03-08 11:50:34 +01:00
import { Meta, Story } from "@storybook/angular";
import { ButtonDirective } from "./button.directive";
2022-03-08 11:50:34 +01:00
export default {
2022-06-17 16:23:04 +02:00
title: "Component Library/Button",
component: ButtonDirective,
2022-03-08 11:50:34 +01:00
args: {
buttonType: "primary",
},
2022-04-08 17:47:32 +02:00
parameters: {
design: {
type: "figma",
url: "https://www.figma.com/file/f32LSg3jaegICkMu7rPARm/Tailwind-Component-Library-Update?node-id=1881%3A16733",
},
},
2022-03-08 11:50:34 +01:00
} as Meta;
const Template: Story<ButtonDirective> = (args: ButtonDirective) => ({
2022-03-08 11:50:34 +01:00
props: args,
template: `
<button bitButton [buttonType]="buttonType" [block]="block">Button</button>
<a bitButton [buttonType]="buttonType" [block]="block" href="#" class="tw-ml-2">Link</a>
`,
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",
};
const DisabledTemplate: Story = (args) => ({
props: args,
template: `
<button bitButton disabled buttonType="primary" class="tw-mr-2">Primary</button>
<button bitButton disabled buttonType="secondary" class="tw-mr-2">Secondary</button>
<button bitButton disabled buttonType="danger" class="tw-mr-2">Danger</button>
2022-03-08 11:50:34 +01:00
`,
});
export const Disabled = DisabledTemplate.bind({});
Disabled.args = {
size: "small",
};
const BlockTemplate: Story<ButtonDirective> = (args: ButtonDirective) => ({
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,
};