File tree Expand file tree Collapse file tree 6 files changed +77
-1
lines changed Expand file tree Collapse file tree 6 files changed +77
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { baseLocales } from "./i18next"
2
+ import { chakraBreakpointArray } from "./preview"
3
+
4
+ export const viewportModes = chakraBreakpointArray . reduce < {
5
+ [ mode : string ] : { viewport : string }
6
+ } > ( ( arr , [ token ] ) => {
7
+ return {
8
+ ...arr ,
9
+ [ token ] : {
10
+ viewport : token ,
11
+ } ,
12
+ }
13
+ } , { } )
14
+
15
+ export const langModes = Object . keys ( baseLocales ) . reduce < {
16
+ [ locale : string ] : { locale : string }
17
+ } > ( ( arr , curr ) => {
18
+ return {
19
+ ...arr ,
20
+ [ curr ] : {
21
+ locale : curr ,
22
+ } ,
23
+ }
24
+ } , { } )
25
+
26
+ type LangViewModeObj = {
27
+ [ key : string ] : { viewport : string ; locale : string }
28
+ }
29
+
30
+ export const langViewportModes = Object . entries (
31
+ viewportModes
32
+ ) . reduce < LangViewModeObj > ( ( arr , curr ) => {
33
+ const [ viewKey , viewVal ] = curr
34
+
35
+ const currLangViewObj = { } as LangViewModeObj
36
+
37
+ Object . entries ( langModes ) . forEach ( ( [ langKey , langVal ] ) => {
38
+ currLangViewObj [ `${ langKey } -${ viewKey } ` ] = {
39
+ viewport : viewVal . viewport ,
40
+ locale : langVal . locale ,
41
+ }
42
+ } )
43
+
44
+ return {
45
+ ...arr ,
46
+ ...currLangViewObj ,
47
+ }
48
+ } , { } )
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import { MotionGlobalConfig } from "framer-motion"
11
11
12
12
MotionGlobalConfig . skipAnimations = isChromatic ( )
13
13
14
- const chakraBreakpointArray = Object . entries ( theme . breakpoints ) as [
14
+ export const chakraBreakpointArray = Object . entries ( theme . breakpoints ) as [
15
15
string ,
16
16
string
17
17
] [ ]
Original file line number Diff line number Diff line change 1
1
import { useTranslation } from "next-i18next"
2
2
import { Meta , StoryObj } from "@storybook/react"
3
3
4
+ import { langViewportModes } from "../../../../.storybook/modes"
5
+
4
6
import ContentHeroComponent , { ContentHeroProps } from "."
5
7
6
8
type ContentHeroType = typeof ContentHeroComponent
@@ -10,6 +12,11 @@ const meta = {
10
12
component : ContentHeroComponent ,
11
13
parameters : {
12
14
layout : "none" ,
15
+ chromatic : {
16
+ modes : {
17
+ ...langViewportModes ,
18
+ } ,
19
+ } ,
13
20
} ,
14
21
argTypes : {
15
22
heroImg : {
Original file line number Diff line number Diff line change 1
1
import * as React from "react"
2
2
import { Meta , StoryObj } from "@storybook/react"
3
3
4
+ import { langViewportModes } from "../../../../.storybook/modes"
5
+
4
6
import HomeHeroComponent from "."
5
7
6
8
type HomeHeroType = typeof HomeHeroComponent
@@ -10,6 +12,11 @@ const meta = {
10
12
component : HomeHeroComponent ,
11
13
parameters : {
12
14
layout : "none" ,
15
+ chromatic : {
16
+ modes : {
17
+ ...langViewportModes ,
18
+ } ,
19
+ } ,
13
20
} ,
14
21
argTypes : {
15
22
heroImg : {
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import { useTranslation } from "next-i18next"
3
3
import { Box } from "@chakra-ui/react"
4
4
import { Meta , StoryObj } from "@storybook/react"
5
5
6
+ import { langViewportModes } from "../../../../.storybook/modes"
7
+
6
8
import HubHeroComponent , { type HubHeroProps } from "./"
7
9
8
10
import learnHubHeroImg from "@/public/heroes/learn-hub-hero.png"
@@ -14,6 +16,11 @@ const meta = {
14
16
component : HubHeroComponent ,
15
17
parameters : {
16
18
layout : "none" ,
19
+ chromatic : {
20
+ modes : {
21
+ ...langViewportModes ,
22
+ } ,
23
+ } ,
17
24
} ,
18
25
decorators : [
19
26
( Story ) => (
Original file line number Diff line number Diff line change 1
1
import { HStack } from "@chakra-ui/react"
2
2
import { Meta , StoryObj } from "@storybook/react"
3
3
4
+ import { langViewportModes } from "../../../../.storybook/modes"
5
+
4
6
import MdxHeroComponent from "./"
5
7
6
8
type MdxHeroType = typeof MdxHeroComponent
@@ -9,6 +11,11 @@ const meta = {
9
11
title : "Organisms / Layouts / Hero" ,
10
12
parameters : {
11
13
layout : "none" ,
14
+ chromatic : {
15
+ modes : {
16
+ ...langViewportModes ,
17
+ } ,
18
+ } ,
12
19
} ,
13
20
decorators : [
14
21
( Story ) => (
You can’t perform that action at this time.
0 commit comments