Skip to content

Commit

Permalink
test: remove legacy chromatic mode and use desktop as default (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
codeincontext authored Dec 10, 2024
1 parent 53fc941 commit 071d2d1
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 30 deletions.
16 changes: 2 additions & 14 deletions apps/nextjs/.storybook/chromatic.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import "@storybook/csf";

type ChromaticModes =
| "legacy"
| "mobile"
| "mobile-wide"
| "desktop"
| "desktop-wide";
type ChromaticModes = "mobile" | "mobile-wide" | "desktop" | "desktop-wide";

export function chromaticParams(modes: ChromaticModes[]) {
return {
Expand All @@ -23,11 +18,6 @@ export function chromaticParams(modes: ChromaticModes[]) {
...(modes.includes("desktop-wide") && {
"desktop-wide": { viewport: "desktopWide" },
}),
// NOTE: Before we used modes, all snapshots were by default in the 1200px mode.
// This option allows us to reuse the existing desktop snapshot until we're ready to migrate
...(modes.includes("legacy") && {
"1200px": { viewport: 1200 as const },
}),
},
},
};
Expand Down Expand Up @@ -84,9 +74,7 @@ declare module "@storybook/csf" {
theme?: "light" | "dark";
backgrounds?: { value: string };
}
> & {
"1200px"?: { viewport: 1200 };
};
>;
/**
* Define one or more viewport sizes to capture. Note, units are considered in pixels
*/
Expand Down
2 changes: 2 additions & 0 deletions apps/nextjs/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { DialogProvider } from "../src/components/AppComponents/DialogContext";
import { AnalyticsProvider } from "../src/mocks/analytics/provider";
import { ClerkDecorator } from "../src/mocks/clerk/ClerkDecorator";
import { TRPCReactProvider } from "../src/utils/trpc";
import { chromaticParams } from "./chromatic";
import { RadixThemeDecorator } from "./decorators/RadixThemeDecorator";
import "./preview.css";

Expand Down Expand Up @@ -48,6 +49,7 @@ const preview: Preview = {
},
},
},
...chromaticParams(["desktop"]),
},
loaders: [mswLoader],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const meta: Meta<typeof DownloadContent> = {
component: DownloadContent,
parameters: {
layout: "fullscreen",
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
decorators: [
(Story) => (
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/aila/[id]/share/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const meta: Meta<typeof ShareChat> = {
component: ShareChat,
parameters: {
layout: "fullscreen",
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
};

Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/aila/help/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const meta: Meta<typeof HelpContent> = {
parameters: {
// Including custom decorators changes the layout from fullscreen
layout: "fullscreen",
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
decorators: [
(Story) => (
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/faqs/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const meta: Meta<typeof FAQPageContent> = {
title: "Pages/FAQs",
component: FAQPageContent,
parameters: {
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
};

Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/home-page.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const meta: Meta<typeof HomePageContent> = {
title: "Pages/Homepage",
component: HomePageContent,
parameters: {
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
};

Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/legal/[slug]/legal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const meta: Meta<typeof LegalContent> = {
title: "Pages/Legal/Sanity dynamic",
component: LegalContent,
parameters: {
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const meta: Meta<typeof AccountLocked> = {
title: "Pages/Legal/Account Locked",
component: AccountLocked,
parameters: {
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
};

Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/prompts/prompts.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const meta: Meta<typeof PromptsContent> = {
title: "Pages/Prompts",
component: PromptsContent,
parameters: {
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const meta: Meta<typeof ChatStart> = {
parameters: {
// Including custom decorators changes the layout from fullscreen
layout: "fullscreen",
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
decorators: [
(Story) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ const meta: Meta<typeof ExportButtons> = {
sectionRefs: {},
documentContainerRef: { current: null },
},
parameters: {
...chromaticParams(["legacy"]),
},
};

export default meta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const meta: Meta<typeof Header> = {
decorators: [DemoDecorator],
parameters: {
layout: "fullscreen",
...chromaticParams(["legacy"]),
docs: {
story: {
height: "150px",
Expand All @@ -48,7 +47,7 @@ export const DemoUser: Story = {
appSessionsPerMonth: 3,
appSessionsRemaining: 2,
},
...chromaticParams(["legacy", "desktop-wide"]),
...chromaticParams(["desktop", "desktop-wide"]),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const meta: Meta<typeof AcceptTermsForm> = {
title: "Pages/Onboarding/AcceptTermsForm",
component: AcceptTermsForm,
parameters: {
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const meta: Meta<typeof LegacyUpgradeNotice> = {
title: "Pages/Onboarding/LegacyUpgradeNotice",
component: LegacyUpgradeNotice,
parameters: {
...chromaticParams(["mobile", "legacy"]),
...chromaticParams(["mobile", "desktop"]),
},
};

Expand Down

0 comments on commit 071d2d1

Please sign in to comment.