Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(components): use desktop breakpoint as default chromatic snapshot #431

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion packages/components/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { MINIMAL_VIEWPORTS } from "@storybook/addon-viewport"
import "bootstrap-icons/font/bootstrap-icons.css"
import "../src/index.css"

import { viewport } from "@isomer/storybook-config"
import { viewport, withChromaticModes } from "@isomer/storybook-config"

const CUSTOM_GENERAL_VIEWPORTS = {
smallDesktop: {
Expand Down Expand Up @@ -87,6 +87,21 @@ const preview: Preview = {
...CUSTOM_GSIB_VIEWPORTS,
},
},
/**
* If tablet view is needed, add it on a per-story basis.
* @example
* ```
* export const SomeStory: Story = {
* parameters: {
* chromatic: withChromaticModes(["mobile", "tablet", "desktop"]),
* }
* }
* ```
*/
chromatic: {
...withChromaticModes(["desktop"]),
prefersReducedMotion: "reduce",
},
},
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react"

import { withChromaticModes } from "@isomer/storybook-config"

import { type CollectionPageSchemaType } from "~/engine"
import CollectionLayout from "./Collection"

Expand All @@ -10,6 +12,7 @@ const meta: Meta<CollectionPageSchemaType> = {
tags: ["!autodocs"],
parameters: {
layout: "fullscreen",
chromatic: withChromaticModes(["mobile", "tablet", "desktop"]),
themes: {
themeOverride: "Isomer Next",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react"

import { withChromaticModes } from "@isomer/storybook-config"

import Content from "./Content"

const meta: Meta<typeof Content> = {
Expand All @@ -9,6 +11,7 @@ const meta: Meta<typeof Content> = {
tags: ["!autodocs"],
parameters: {
layout: "fullscreen",
chromatic: withChromaticModes(["mobile", "tablet", "desktop"]),
themes: {
themeOverride: "Isomer Next",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Meta, StoryObj } from "@storybook/react"
import { useEffect } from "react"

import { withChromaticModes } from "@isomer/storybook-config"

import type { HomePageSchemaType } from "~/engine"
import Homepage from "./Homepage"

Expand All @@ -24,6 +26,7 @@ const meta: Meta<typeof Homepage> = {
tags: ["!autodocs"],
parameters: {
layout: "fullscreen",
chromatic: withChromaticModes(["mobile", "tablet", "desktop"]),
themes: {
themeOverride: "Isomer Next",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react"

import { withChromaticModes } from "@isomer/storybook-config"

import type { NotFoundPageSchemaType } from "~/engine"
import NotFoundLayout from "./NotFound"

Expand All @@ -10,6 +12,7 @@ const meta: Meta<NotFoundPageSchemaType> = {
tags: ["!autodocs"],
parameters: {
layout: "fullscreen",
chromatic: withChromaticModes(["mobile", "tablet", "desktop"]),
themes: {
themeOverride: "Isomer Next",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Meta, StoryObj } from "@storybook/react"
import { useEffect } from "react"

import { withChromaticModes } from "@isomer/storybook-config"

import type { SearchPageSchemaType } from "~/engine"
import SearchLayout from "./Search"

Expand Down Expand Up @@ -29,6 +31,7 @@ const meta: Meta<typeof Template> = {
argTypes: {},
tags: ["!autodocs"],
parameters: {
chromatic: withChromaticModes(["mobile", "tablet", "desktop"]),
themes: {
themeOverride: "Isomer Next",
},
Expand Down
Loading