Skip to content

Commit 13da521

Browse files
refactor: create import alias for .storybook directory
1 parent e170a44 commit 13da521

File tree

12 files changed

+25
-16
lines changed

12 files changed

+25
-16
lines changed

.eslintrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
["^@/data"],
3434
// From the `constants` directory.
3535
["^@/lib/constants"],
36-
// From the `.storybook/utils` file
37-
["^@/storybook-utils"],
36+
// `.storybook` directory and utils files`
37+
["^@/storybook","^@/storybook-utils"],
3838
// Parent imports. Put `..` last.
3939
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
4040
// Other relative imports. Put same-folder imports and `.` last.

.storybook/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import path from "path"
2+
13
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin"
24
import type { StorybookConfig } from "@storybook/nextjs"
35

@@ -51,6 +53,11 @@ const config: StorybookConfig = {
5153
extensions: config.resolve.extensions,
5254
}),
5355
]
56+
57+
config.resolve.alias = {
58+
...config.resolve.alias,
59+
"@/storybook/*": path.resolve(__dirname, "./.storybook/"),
60+
}
5461
}
5562

5663
// This modifies the existing image rule to exclude .svg files

src/components/Hero/ContentHero/ContentHero.stories.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { Meta, StoryObj } from "@storybook/react"
22

3+
import { langViewportModes } from "@/storybook/modes"
34
import { getTranslation } from "@/storybook-utils"
45

5-
import { langViewportModes } from "../../../../.storybook/modes"
6-
76
import ContentHeroComponent, { ContentHeroProps } from "."
87

98
const meta = {

src/components/Hero/HomeHero/HomeHero.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { Meta, StoryObj } from "@storybook/react"
22

3-
import { langViewportModes } from "../../../../.storybook/modes"
3+
import { langViewportModes } from "@/storybook/modes"
44

55
import HomeHeroComponent from "."
66

7+
import homeHeroImg from "@/public/images/home/hero.png"
8+
79
const meta = {
810
title: "Organisms / Layouts / Hero",
911
component: HomeHeroComponent,
@@ -26,8 +28,6 @@ const meta = {
2628

2729
export default meta
2830

29-
import homeHeroImg from "@/public/images/home/hero.png"
30-
3131
export const HomeHero: StoryObj<typeof meta> = {
3232
args: {
3333
heroImg: homeHeroImg,

src/components/Hero/HubHero/HubHero.stories.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import { Meta, StoryObj } from "@storybook/react"
33

44
import { screens } from "@/lib/utils/screen"
55

6+
import { langViewportModes } from "@/storybook/modes"
67
import { getTranslation } from "@/storybook-utils"
78

8-
import { langViewportModes } from "../../../../.storybook/modes"
9-
109
import HubHeroComponent, { type HubHeroProps } from "./"
1110

1211
import learnHubHeroImg from "@/public/images/heroes/learn-hub-hero.png"

src/components/Hero/MdxHero/MdxHero.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { HStack } from "@/components/ui/flex"
55

66
import { screens } from "@/lib/utils/screen"
77

8-
import { langViewportModes } from "../../../../.storybook/modes"
8+
import { langViewportModes } from "@/storybook/modes"
99

1010
import MdxHeroComponent from "./"
1111

src/components/MdComponents/MdComponents.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pickBy from "lodash/pickBy"
22
import type { Meta, StoryObj } from "@storybook/react/*"
33

4-
import { viewportModes } from "../../../.storybook/modes"
4+
import { viewportModes } from "@/storybook/modes"
55

66
import MdComponentSet from "."
77

src/components/MergeInfographic/MergeInfographic.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Meta, StoryObj } from "@storybook/react"
22

3-
import { langViewportModes } from "../../../.storybook/modes"
3+
import { langViewportModes } from "@/storybook/modes"
44

55
import MergeInfographicComponent from "."
66

src/components/Simulator/__stories__/Explanation.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import pickBy from "lodash/pickBy"
22
import type { Meta, StoryObj } from "@storybook/react"
33
import { fn } from "@storybook/test"
44

5-
import { viewportModes } from "../../../../.storybook/modes"
5+
import { viewportModes } from "@/storybook/modes"
6+
67
import { Explanation as ExplanationComponent } from "../Explanation"
78
import { SendReceiveIcon } from "../icons"
89

src/layouts/stories/BaseLayout.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import type { Meta, StoryObj } from "@storybook/react"
22

33
import { Center } from "@/components/ui/flex"
44

5-
import { langViewportModes } from "../../../.storybook/modes"
5+
import { langViewportModes } from "@/storybook/modes"
6+
67
import { BaseLayout as BaseLayoutComponent } from "../BaseLayout"
78

89
const meta = {

0 commit comments

Comments
 (0)