Skip to content

Commit

Permalink
refactor: Centralize Chromatic parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
haideralsh committed Dec 5, 2024
1 parent aa30d94 commit 6537b5a
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 26 deletions.
6 changes: 2 additions & 4 deletions src/BottomSheet/stories/BottomSheet.actions.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import React from "react";
import { Button, PrimaryButton, QuietButton } from "../../Button";
import { Placeholder } from "../../utils/story/placeholder";
import BottomSheet from "../BottomSheet";
import { storyParams } from "./BottomSheet.story";

export default {
...storyParams,
title: "Components/BottomSheet/Actions",
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
parameters: {
chromatic: { delay: 1000 },
},
};

export const WithAHiddenCloseButton = () => {
Expand Down
6 changes: 2 additions & 4 deletions src/BottomSheet/stories/BottomSheet.content.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import { Link } from "../../Link";
import { Text } from "../../Type";
import { Placeholder } from "../../utils/story/placeholder";
import BottomSheet from "../BottomSheet";
import { storyParams } from "./BottomSheet.story";

export default {
...storyParams,
title: "Components/BottomSheet/Content",
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
parameters: {
chromatic: { delay: 1000 },
},
};

export const WithHelpText = () => {
Expand Down
6 changes: 2 additions & 4 deletions src/BottomSheet/stories/BottomSheet.features.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ import { toast, ToastContainer } from "../../ToastContainer";
import { Text } from "../../Type";
import { Placeholder } from "../../utils/story/placeholder";
import BottomSheet from "../BottomSheet";
import { storyParams } from "./BottomSheet.story";

export default {
...storyParams,
title: "Components/BottomSheet/Features",
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
parameters: {
chromatic: { delay: 1000 },
},
};

export const WithCustomWidths = () => {
Expand Down
6 changes: 2 additions & 4 deletions src/BottomSheet/stories/BottomSheet.parts.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import { Flex } from "../../Flex";
import { Link } from "../../Link";
import { Placeholder } from "../../utils/story/placeholder";
import { BottomSheetParts as BottomSheet } from "../BottomSheet.parts";
import { storyParams } from "./BottomSheet.story";

export default {
...storyParams,
title: "Components/BottomSheet/Parts",
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
parameters: {
chromatic: { delay: 1000 },
},
};

export const RenderedUsingCompositionalAPI = () => {
Expand Down
8 changes: 6 additions & 2 deletions src/BottomSheet/stories/BottomSheet.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ import { Button } from "../../Button";
import { Placeholder } from "../../utils/story/placeholder";
import BottomSheet from "../BottomSheet";

export default {
title: "Components/BottomSheet",
export const storyParams = {
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
parameters: {
chromatic: { delay: 1000 },
},
} as const;

export default {
...storyParams,
title: "Components/BottomSheet",
};

export const BasicUsage = () => {
Expand Down
5 changes: 2 additions & 3 deletions src/TopBar/stories/TopBar.backButton.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from "react";
import { Link, BrowserRouter } from "react-router-dom";
import { TopBar } from "../TopBar";
import { menuItems } from "./fixtures";
import { storyParams } from "./TopBar.story";

export default {
...storyParams,
title: "Components/TopBar/BackLink",
parameters: {
layout: "fullscreen",
},
};

export const WithNoLabel = () => (
Expand Down
5 changes: 2 additions & 3 deletions src/TopBar/stories/TopBar.menu.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from "react";
import { Link, BrowserRouter } from "react-router-dom";
import { TopBar } from "../TopBar";
import { menuItems } from "./fixtures";
import { storyParams } from "./TopBar.story";

export default {
...storyParams,
title: "Components/TopBar/Menu",
parameters: {
layout: "fullscreen",
},
};

export const withDefaultOpenMenu = () => (
Expand Down
14 changes: 12 additions & 2 deletions src/TopBar/stories/TopBar.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@ import React from "react";
import { FormSection } from "../../Form";
import { Input } from "../../Input";
import { ApplicationFrame, Page } from "../../Layout";
import { legacy as theme } from "../../theme/theme";
import numberFromDimension from "../../utils/numberFromDimension";
import { TopBar } from "../TopBar";
import { menuItems } from "./fixtures";

export default {
title: "Components/TopBar",
export const storyParams = {
parameters: {
layout: "fullscreen",
chromatic: {
viewports: [theme.breakpoints.small, theme.breakpoints.medium, theme.breakpoints.large].map(numberFromDimension),
delay: 1000,
},
},
} as const;

export default {
...storyParams,
title: "Components/TopBar",
};

export const Default = () => (
Expand Down

0 comments on commit 6537b5a

Please sign in to comment.