Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Kzn 1058 how can we style storybook create a poc #3347

Merged
merged 14 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"node": ">=v16.13.1"
},
"scripts": {
"storybook": "start-storybook -p 6006 -c storybook",
"storybook": "IS_DEV=true start-storybook -p 6006 -c storybook",
JakePitman marked this conversation as resolved.
Show resolved Hide resolved
"storybook:build": "build-storybook -c storybook -o storybook/public --no-manager-cache",
"eslint": "eslint . -c .eslintrc.js --ext .ts,.tsx",
"prettier": "prettier --check '**/*'",
Expand Down
Binary file added storybook/assets/kaizen-badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions storybook/assets/kaizen-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions storybook/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ export const CATEGORIES = {
deprecated: "Deprecated",
tailwind: "Systems/Tailwind",
systems: "Systems",
aio: "AIO",
}

export const CATEGORIES_ICON = {
[CATEGORIES.introduction]: "👋",
[CATEGORIES.components]: "⚙️",
[CATEGORIES.helpers]: "🤝",
[CATEGORIES.designTokens]: "🎨",
[CATEGORIES.deprecated]: "💣",
[CATEGORIES.systems]: "🤖",
[CATEGORIES.aio]: "📦",
}

export const SUB_CATEGORIES = {
Expand Down
1 change: 1 addition & 0 deletions storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ module.exports = {
"storybook-addon-designs",
],
presets: [path.resolve("./storybook/header-preset/preset")],
staticDirs: [{ from: "./assets", to: "/static/media" }],
}
12 changes: 12 additions & 0 deletions storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<link
rel="stylesheet"
href="./manager.css"
/>

<style>
body .sidebar-item:hover{background:#dfc9ea}
body .search-result-item:hover{background:#dfc9ea}
body .search-result-recentlyOpened,
body .search-result-back *,
body .search-result-clearHistory *{color:#2f2438}
</style>
4 changes: 4 additions & 0 deletions storybook/manager.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.sidebar-item {
JakePitman marked this conversation as resolved.
Show resolved Hide resolved
background-color: red !important;
color: lime !important;
}
11 changes: 0 additions & 11 deletions storybook/manager.ts

This file was deleted.

37 changes: 37 additions & 0 deletions storybook/manager.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// This file is used by storybook to register installed addons.
// See: https://storybook.js.org/docs/addons/using-addons/
import React from "react"
import { addons } from "@storybook/addons"
import { defaultTheme } from "@kaizen/design-tokens"
import { CATEGORIES_ICON } from "./constants"
import KaizenTheme from "./theme"

const colors = defaultTheme.color

addons.setConfig({
theme: KaizenTheme,
analyticsGTM: {
gtmId: "GTM-KS4VWLT",
},
sidebar: {
renderLabel: item =>
item.type === "root" ? (
<span
style={{
color: colors.purple["800"],
JakePitman marked this conversation as resolved.
Show resolved Hide resolved
textTransform: "capitalize",
fontSize: "13px",
letterSpacing: "normal",
fontWeight: 600,
}}
>
<span aria-hidden style={{ marginRight: defaultTheme.spacing[6] }}>
{CATEGORIES_ICON[item.name]}
</span>
{item.name}
</span>
) : (
item.name
),
},
})
35 changes: 27 additions & 8 deletions storybook/theme.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
/* eslint import/no-extraneous-dependencies: 0 */

import { create } from "@storybook/theming/create"
import { ThemeVars, create } from "@storybook/theming"
import { defaultTheme } from "@kaizen/design-tokens"
const logo = require("./assets/kaizen-badge.svg")
const colors = defaultTheme.color

export default create({
const theme: ThemeVars = create({
base: "light",
brandTitle: "🌱 Storybook",

colorSecondary: colors.purple["600"],
// UI
appBg: colors.purple["100"],
appContentBg: colors.white,
appBorderColor: colors.gray["300"],
appBorderRadius: 7,
// Typography
fontBase: '"Inter", "Noto Sans", Helvetica, Arial, sans-serif',
fontCode: "monospace",

// Text colors
// Doesn't seem to like CSS Variables wah
textColor: defaultTheme.color.purple["800"],
textColor: colors.purple["800"],
textInverseColor: colors.white,
textMutedColor: "rgba(85, 75, 95)",
// Toolbar default and active colors
barTextColor: colors.gray["600"],
barSelectedColor: colors.purple["600"],
barBg: colors.white,
// Form colors
inputBg: colors.white,
inputBorder: colors.gray["500"],
inputTextColor: colors.gray["600"],
inputBorderRadius: 20,
brandTitle: "Kaizen Storybook",
brandImage:
process.env.IS_DEV === "true" ? logo : "./static/media/kaizen-badge.svg",
})

export default theme