-
Notifications
You must be signed in to change notification settings - Fork 0
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 #113 from oaknational/chore/PUPIL-439/storybook-theme
chore(PUPIL-439): add some basic Oak branding to Storybook
- Loading branch information
Showing
8 changed files
with
64 additions
and
0 deletions.
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 |
---|---|---|
|
@@ -20,5 +20,6 @@ const config = { | |
docs: { | ||
autodocs: "tag", | ||
}, | ||
staticDirs: ["./public"], | ||
}; | ||
export default config; |
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,4 @@ | ||
<link | ||
href="https://googleapis-fonts.thenational.academy/css2?family=Lexend:wght@300;400;600&display=swap" | ||
rel="stylesheet" | ||
/> |
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,6 @@ | ||
import { addons } from "@storybook/manager-api"; | ||
import { oakStorybookTheme } from "./oakStorybookTheme"; | ||
|
||
addons.setConfig({ | ||
theme: oakStorybookTheme, | ||
}); |
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,43 @@ | ||
import { create } from "@storybook/theming/create"; | ||
import assert from "assert"; | ||
|
||
// @ts-expect-error: this is an svg | ||
import brandImage from "../assets/logo.svg"; | ||
import { oakDefaultTheme } from "../src/styles/theme/default.theme"; | ||
import { OakUiRoleToken, oakColorTokens } from "../src/styles/theme/color"; | ||
import { oakBorderRadiusTokens } from "../src/styles/theme/borders"; | ||
|
||
export const oakStorybookTheme = create({ | ||
base: "light", | ||
brandTitle: "Oak National Academy", | ||
brandUrl: "https://www.thenational.academy", | ||
brandImage, | ||
fontBase: "Lexend, sans-serif", | ||
colorPrimary: oakColorTokens.mint, | ||
colorSecondary: oakColorTokens.oakGreen, | ||
|
||
appBg: getUIColor("bg-decorative1-very-subdued"), | ||
appBorderColor: getUIColor("border-neutral"), | ||
appBorderRadius: oakBorderRadiusTokens["border-radius-m"], | ||
|
||
textColor: getUIColor("text-primary"), | ||
textInverseColor: getUIColor("text-inverted"), | ||
textMutedColor: getUIColor("text-subdued"), | ||
|
||
inputBorder: getUIColor("border-primary"), | ||
inputTextColor: getUIColor("text-primary"), | ||
inputBorderRadius: oakBorderRadiusTokens["border-radius-m"], | ||
|
||
barTextColor: getUIColor("icon-inverted"), | ||
barSelectedColor: getUIColor("icon-inverted"), | ||
buttonBg: getUIColor("bg-btn-secondary"), | ||
buttonBorder: getUIColor("border-primary"), | ||
barHoverColor: getUIColor("text-primary"), | ||
}); | ||
|
||
function getUIColor(uiColor: OakUiRoleToken) { | ||
const colorName = oakDefaultTheme.uiColors[uiColor]; | ||
assert(colorName, `Color '${uiColor}' not found in theme`); | ||
|
||
return oakColorTokens[colorName]; | ||
} |
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,4 @@ | ||
<link | ||
href="https://googleapis-fonts.thenational.academy/css2?family=Lexend:wght@300;400;600&display=swap" | ||
rel="stylesheet" | ||
/> |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.