2023-05-26 15:58:06 +02:00
|
|
|
import { Meta, moduleMetadata, StoryObj } from "@storybook/angular";
|
2022-09-15 07:38:29 +02:00
|
|
|
|
|
|
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|
|
|
|
|
|
|
import { IconButtonModule } from "../icon-button";
|
2023-05-05 17:13:54 +02:00
|
|
|
import { LinkModule } from "../link";
|
2022-09-15 07:38:29 +02:00
|
|
|
import { SharedModule } from "../shared/shared.module";
|
|
|
|
import { I18nMockService } from "../utils/i18n-mock.service";
|
2022-04-25 18:02:09 +02:00
|
|
|
|
|
|
|
import { BannerComponent } from "./banner.component";
|
|
|
|
|
|
|
|
export default {
|
2022-06-17 16:23:04 +02:00
|
|
|
title: "Component Library/Banner",
|
2022-04-25 18:02:09 +02:00
|
|
|
component: BannerComponent,
|
2022-09-15 07:38:29 +02:00
|
|
|
decorators: [
|
|
|
|
moduleMetadata({
|
2023-05-05 17:13:54 +02:00
|
|
|
imports: [SharedModule, IconButtonModule, LinkModule],
|
2022-09-15 07:38:29 +02:00
|
|
|
providers: [
|
|
|
|
{
|
|
|
|
provide: I18nService,
|
|
|
|
useFactory: () => {
|
|
|
|
return new I18nMockService({
|
|
|
|
close: "Close",
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
],
|
2022-10-24 19:20:38 +02:00
|
|
|
parameters: {
|
|
|
|
design: {
|
|
|
|
type: "figma",
|
|
|
|
url: "https://www.figma.com/file/Zt3YSeb6E6lebAffrNLa0h/Tailwind-Component-Library?node-id=2070%3A17207",
|
|
|
|
},
|
|
|
|
},
|
2022-04-25 18:02:09 +02:00
|
|
|
args: {
|
|
|
|
bannerType: "warning",
|
|
|
|
},
|
2022-09-15 07:38:29 +02:00
|
|
|
argTypes: {
|
|
|
|
onClose: { action: "onClose" },
|
|
|
|
},
|
2023-05-26 15:58:06 +02:00
|
|
|
} as Meta<BannerComponent>;
|
2022-04-25 18:02:09 +02:00
|
|
|
|
2023-05-26 15:58:06 +02:00
|
|
|
type Story = StoryObj<BannerComponent>;
|
|
|
|
|
|
|
|
export const Premium: Story = {
|
|
|
|
args: {
|
|
|
|
bannerType: "premium",
|
|
|
|
},
|
|
|
|
render: (args: BannerComponent) => ({
|
|
|
|
props: args,
|
|
|
|
template: `
|
|
|
|
<bit-banner [bannerType]="bannerType" (onClose)="onClose($event)">
|
2022-10-24 19:20:38 +02:00
|
|
|
Content Really Long Text Lorem Ipsum Ipsum Ipsum
|
2023-05-05 17:13:54 +02:00
|
|
|
<button bitLink linkType="contrast">Button</button>
|
2023-05-26 15:58:06 +02:00
|
|
|
</bit-banner>
|
|
|
|
`,
|
|
|
|
}),
|
|
|
|
};
|
2022-04-25 18:02:09 +02:00
|
|
|
|
|
|
|
Premium.args = {
|
|
|
|
bannerType: "premium",
|
|
|
|
};
|
|
|
|
|
2023-05-26 15:58:06 +02:00
|
|
|
export const Info: Story = {
|
|
|
|
...Premium,
|
|
|
|
args: {
|
|
|
|
bannerType: "info",
|
|
|
|
},
|
2022-04-25 18:02:09 +02:00
|
|
|
};
|
|
|
|
|
2023-05-26 15:58:06 +02:00
|
|
|
export const Warning: Story = {
|
|
|
|
...Premium,
|
|
|
|
args: {
|
|
|
|
bannerType: "warning",
|
|
|
|
},
|
2022-04-25 18:02:09 +02:00
|
|
|
};
|
|
|
|
|
2023-05-26 15:58:06 +02:00
|
|
|
export const Danger: Story = {
|
|
|
|
...Premium,
|
|
|
|
args: {
|
|
|
|
bannerType: "danger",
|
|
|
|
},
|
2022-04-25 18:02:09 +02:00
|
|
|
};
|