1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-06-26 10:35:48 +02:00
bitwarden-browser/libs/components/src/dialog/dialog/dialog.stories.ts

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

99 lines
2.7 KiB
TypeScript
Raw Normal View History

2022-08-05 17:45:36 +02:00
import { Meta, moduleMetadata, Story } from "@storybook/angular";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
2022-08-05 17:45:36 +02:00
import { ButtonModule } from "../../button";
import { SharedModule } from "../../shared";
import { I18nMockService } from "../../utils/i18n-mock.service";
import { DialogCloseDirective } from "../directives/dialog-close.directive";
import { DialogTitleContainerDirective } from "../directives/dialog-title-container.directive";
2022-08-05 17:45:36 +02:00
import { DialogComponent } from "./dialog.component";
export default {
title: "Component Library/Dialogs/Dialog",
component: DialogComponent,
decorators: [
moduleMetadata({
imports: [SharedModule, ButtonModule],
declarations: [DialogTitleContainerDirective, DialogCloseDirective],
providers: [
{
provide: I18nService,
useFactory: () => {
return new I18nMockService({
close: "Close",
});
},
},
],
2022-08-05 17:45:36 +02:00
}),
],
args: {
dialogSize: "small",
},
parameters: {
design: {
type: "figma",
url: "https://www.figma.com/file/Zt3YSeb6E6lebAffrNLa0h/Tailwind-Component-Library",
},
},
} as Meta;
const Template: Story<DialogComponent> = (args: DialogComponent) => ({
props: args,
template: `
<bit-dialog [dialogSize]="dialogSize">
<span bitDialogTitle>{{title}}</span>
<span bitDialogContent>Dialog body text goes here.</span>
<div bitDialogFooter class="tw-flex tw-flex-row tw-gap-2">
2022-08-05 17:45:36 +02:00
<button bitButton buttonType="primary">Save</button>
<button bitButton buttonType="secondary">Cancel</button>
</div>
</bit-dialog>
`,
});
export const Default = Template.bind({});
Default.args = {
dialogSize: "default",
title: "Default",
};
export const Small = Template.bind({});
Small.args = {
dialogSize: "small",
title: "Small",
};
export const Large = Template.bind({});
Large.args = {
dialogSize: "large",
title: "Large",
};
const TemplateScrolling: Story<DialogComponent> = (args: DialogComponent) => ({
props: args,
template: `
<bit-dialog [dialogSize]="dialogSize">
<span bitDialogTitle>Scrolling Example</span>
<span bitDialogContent>
2022-08-05 17:45:36 +02:00
Dialog body text goes here.<br>
<ng-container *ngFor="let _ of [].constructor(100)">
repeating lines of characters <br>
</ng-container>
end of sequence!
</span>
<div bitDialogFooter class="tw-flex tw-flex-row tw-gap-2">
2022-08-05 17:45:36 +02:00
<button bitButton buttonType="primary">Save</button>
<button bitButton buttonType="secondary">Cancel</button>
</div>
</bit-dialog>
`,
});
export const ScrollingContent = TemplateScrolling.bind({});
ScrollingContent.args = {
dialogSize: "small",
};