-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12668 from TylerAPfledderer/feat/chromatic-story-…
…modes feat(storybook): build story modes
- Loading branch information
Showing
6 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { baseLocales } from "./i18next" | ||
import { chakraBreakpointArray } from "./preview" | ||
|
||
export const viewportModes = chakraBreakpointArray.reduce<{ | ||
[mode: string]: { viewport: string } | ||
}>((arr, [token]) => { | ||
return { | ||
...arr, | ||
[token]: { | ||
viewport: token, | ||
}, | ||
} | ||
}, {}) | ||
|
||
export const langModes = Object.keys(baseLocales).reduce<{ | ||
[locale: string]: { locale: string } | ||
}>((arr, curr) => { | ||
return { | ||
...arr, | ||
[curr]: { | ||
locale: curr, | ||
}, | ||
} | ||
}, {}) | ||
|
||
type LangViewModeObj = { | ||
[key: string]: { viewport: string; locale: string } | ||
} | ||
|
||
export const langViewportModes = Object.entries( | ||
viewportModes | ||
).reduce<LangViewModeObj>((arr, curr) => { | ||
const [viewKey, viewVal] = curr | ||
|
||
const currLangViewObj = {} as LangViewModeObj | ||
|
||
Object.entries(langModes).forEach(([langKey, langVal]) => { | ||
currLangViewObj[`${langKey}-${viewKey}`] = { | ||
viewport: viewVal.viewport, | ||
locale: langVal.locale, | ||
} | ||
}) | ||
|
||
return { | ||
...arr, | ||
...currLangViewObj, | ||
} | ||
}, {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters