diff --git a/apps/nextjs/.storybook/chromatic.ts b/apps/nextjs/.storybook/chromatic.ts index d5f4c6c31..e70ccc1d9 100644 --- a/apps/nextjs/.storybook/chromatic.ts +++ b/apps/nextjs/.storybook/chromatic.ts @@ -1,10 +1,27 @@ import "@storybook/csf"; +const defaultMode = { "1200px": { viewport: 1200 } } as const; +const mobileMode = { mobile: { viewport: 375 } }; +const desktopMode = { desktop: { viewport: 1200 } }; + +export const CHROMATIC_MOBILE_ONLY = { + chromatic: { modes: mobileMode }, +}; +export const CHROMATIC_DESKTOP_ONLY = { + chromatic: { modes: desktopMode }, +}; export const CHROMATIC_ALL_VIEWPORTS = { - chromatic: { viewports: [375, 1200] }, + chromatic: { modes: { ...mobileMode, ...desktopMode } }, +}; + +// NOTE: Before we used modes, all snapshots were by default in the 1200px mode. +// These options allow us to reuse the existing desktop snapshot until we're ready to migrate +export const CHROMATIC_DESKTOP_COMPAT = { + chromatic: { modes: defaultMode }, +}; +export const CHROMATIC_ALL_VIEWPORTS_COMPAT = { + chromatic: { modes: { ...mobileMode, ...defaultMode } }, }; -export const CHROMATIC_MOBILE_ONLY = { chromatic: { viewports: [375] } }; -export const CHROMATIC_DESKTOP_ONLY = { chromatic: { viewports: [1200] } }; declare module "@storybook/csf" { interface Parameters { diff --git a/apps/nextjs/.storybook/preview.tsx b/apps/nextjs/.storybook/preview.tsx index f0b9471c5..99b2ad60e 100644 --- a/apps/nextjs/.storybook/preview.tsx +++ b/apps/nextjs/.storybook/preview.tsx @@ -15,7 +15,6 @@ 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 { CHROMATIC_DESKTOP_ONLY } from "./chromatic"; import { RadixThemeDecorator } from "./decorators/RadixThemeDecorator"; import "./preview.css"; @@ -29,7 +28,6 @@ const preview: Preview = { date: /Date$/i, }, }, - ...CHROMATIC_DESKTOP_ONLY, }, loaders: [mswLoader], }; diff --git a/apps/nextjs/src/app/faqs/index.stories.tsx b/apps/nextjs/src/app/faqs/index.stories.tsx index 7eef2c06a..3b680d677 100644 --- a/apps/nextjs/src/app/faqs/index.stories.tsx +++ b/apps/nextjs/src/app/faqs/index.stories.tsx @@ -1,10 +1,14 @@ import type { Meta, StoryObj } from "@storybook/react"; import { FAQPageContent } from "."; +import { CHROMATIC_ALL_VIEWPORTS_COMPAT } from "../../../.storybook/chromatic"; const meta: Meta = { title: "Pages/FAQs", component: FAQPageContent, + parameters: { + ...CHROMATIC_ALL_VIEWPORTS_COMPAT, + }, }; export default meta; diff --git a/apps/nextjs/src/components/AppComponents/Chat/export-buttons/index.stories.tsx b/apps/nextjs/src/components/AppComponents/Chat/export-buttons/index.stories.tsx index 5bb6c592e..0acdae769 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/export-buttons/index.stories.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/export-buttons/index.stories.tsx @@ -4,7 +4,7 @@ import type { ChatContextProps } from "@/components/ContextProviders/ChatProvide import { ChatContext } from "@/components/ContextProviders/ChatProvider"; import { DemoContext } from "@/components/ContextProviders/Demo"; -import { CHROMATIC_DESKTOP_ONLY } from "../../../../../.storybook/chromatic"; +import { CHROMATIC_DESKTOP_COMPAT } from "../../../../../.storybook/chromatic"; import ExportButtons from "./"; const ChatDecorator: Story["decorators"] = (Story, { parameters }) => ( @@ -44,7 +44,7 @@ const meta: Meta = { documentContainerRef: { current: null }, }, parameters: { - ...CHROMATIC_DESKTOP_ONLY, + ...CHROMATIC_DESKTOP_COMPAT, }, };