mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
Migrate Chromatic (#2906)
This commit is contained in:
33
.storybook/preview.js
Normal file
33
.storybook/preview.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { setCompodocJson } from "@storybook/addon-docs/angular";
|
||||
import { componentWrapperDecorator, addDecorator } from "@storybook/angular";
|
||||
|
||||
import docJson from "../documentation.json";
|
||||
setCompodocJson(docJson);
|
||||
|
||||
export const parameters = {
|
||||
actions: { argTypesRegex: "^on[A-Z].*" },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/,
|
||||
},
|
||||
},
|
||||
docs: { inlineStories: true },
|
||||
};
|
||||
|
||||
// ng-template is used to scope any template reference variables and isolate the previews
|
||||
const decorator = componentWrapperDecorator(
|
||||
(story) => `
|
||||
<ng-template #lightPreview>
|
||||
<div class="theme_light tw-px-5 tw-py-10 tw-border-2 tw-border-solid tw-border-secondary-300 tw-bg-[#ffffff]">${story}</div>
|
||||
</ng-template>
|
||||
<ng-template #darkPreview>
|
||||
<div class="theme_dark tw-mt-5 tw-px-5 tw-py-10 tw-bg-[#1f242e]">${story}</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-container *ngTemplateOutlet="lightPreview"></ng-container>
|
||||
<ng-container *ngTemplateOutlet="darkPreview"></ng-container>
|
||||
`
|
||||
);
|
||||
|
||||
addDecorator(decorator);
|
||||
Reference in New Issue
Block a user