1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[CL-317] Use storybook theme addon for theme switching (#13451)

This commit is contained in:
Vicki League
2025-02-18 15:29:47 -05:00
committed by GitHub
parent a2c23aa661
commit 6e4a06dab4
8 changed files with 41 additions and 65 deletions

View File

@@ -9,10 +9,7 @@ import { ButtonModule } from "../button";
import { CalloutModule } from "../callout";
import { LayoutComponent } from "../layout";
import { mockLayoutI18n } from "../layout/mocks";
import {
disableBothThemeDecorator,
positionFixedWrapperDecorator,
} from "../stories/storybook-decorators";
import { positionFixedWrapperDecorator } from "../stories/storybook-decorators";
import { TypographyModule } from "../typography";
import { I18nMockService } from "../utils";
@@ -30,7 +27,6 @@ export default {
},
decorators: [
positionFixedWrapperDecorator(),
disableBothThemeDecorator,
moduleMetadata({
imports: [
RouterTestingModule,

View File

@@ -17,7 +17,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
import { DialogService } from "../../dialog";
import { LayoutComponent } from "../../layout";
import { I18nMockService } from "../../utils/i18n-mock.service";
import { disableBothThemeDecorator, positionFixedWrapperDecorator } from "../storybook-decorators";
import { positionFixedWrapperDecorator } from "../storybook-decorators";
import { DialogVirtualScrollBlockComponent } from "./components/dialog-virtual-scroll-block.component";
import { KitchenSinkForm } from "./components/kitchen-sink-form.component";
@@ -31,7 +31,6 @@ export default {
component: LayoutComponent,
decorators: [
positionFixedWrapperDecorator(),
disableBothThemeDecorator,
moduleMetadata({
imports: [
KitchenSinkSharedModule,

View File

@@ -17,15 +17,3 @@ export const positionFixedWrapperDecorator = (wrapper?: (story: string) => strin
${wrapper ? wrapper(story) : story}
</div>`,
);
export const disableBothThemeDecorator = componentWrapperDecorator(
(story) => story,
({ globals }) => {
/**
* avoid a bug with the way that we render the same component twice in the same iframe and how
* that interacts with the router-outlet
*/
const themeOverride = globals["theme"] === "both" ? "light" : globals["theme"];
return { theme: themeOverride };
},
);