-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13b551c
commit c01bb3d
Showing
41 changed files
with
6,054 additions
and
267 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"extends": "nx/presets/npm.json", | ||
"$schema": "./node_modules/nx/schemas/nx-schema.json", | ||
"tasksRunnerOptions": { | ||
"default": { | ||
"runner": "nx/tasks-runners/default", | ||
"options": { | ||
"cacheableOperations": ["build", "lint", "test", "e2e"] | ||
"cacheableOperations": ["build", "lint", "test", "e2e", "build-storybook"] | ||
} | ||
} | ||
} | ||
}, | ||
"extends": "nx/presets/npm.json", | ||
"$schema": "./node_modules/nx/schemas/nx-schema.json" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type {StorybookConfig} from '@storybook/react-vite'; | ||
|
||
import {nxViteTsPaths} from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; | ||
import {mergeConfig} from 'vite'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../**/*.stories.@(mdx|tsx)', '../stories/*.mdx'], | ||
addons: ['@storybook/addon-essentials'], | ||
framework: { | ||
name: '@storybook/react-vite', | ||
options: {}, | ||
}, | ||
|
||
viteFinal: async config => | ||
mergeConfig(config, { | ||
plugins: [nxViteTsPaths()], | ||
}), | ||
}; | ||
|
||
export default config; | ||
|
||
// To customize your Vite configuration you can use the viteFinal field. | ||
// Check https://storybook.js.org/docs/react/builders/vite#configuration | ||
// and https://nx.dev/packages/storybook/documents/custom-builder-configs |
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,16 @@ | ||
import {Preview} from '@storybook/react'; | ||
import '@workday/canvas-tokens-web/dist/css/base/_variables.css'; | ||
import '@workday/canvas-tokens-web/dist/css/brand/_variables.css'; | ||
import '@workday/canvas-tokens-web/dist/css/system/_variables.css'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
options: { | ||
storySort: { | ||
order: ['Docs', ['Getting Started'], 'Visual Tests'], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
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,24 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"composite": true, | ||
"outDir": "" | ||
}, | ||
"files": [ | ||
"../../../node_modules/@nx/react/typings/styled-jsx.d.ts", | ||
"../../../node_modules/@nx/react/typings/cssmodule.d.ts", | ||
"../../../node_modules/@nx/react/typings/image.d.ts" | ||
], | ||
"exclude": ["../**/*.spec.ts", "../**/*.spec.js", "../**/*.spec.tsx", "../**/*.spec.jsx"], | ||
"include": [ | ||
"../src/**/*.stories.ts", | ||
"../src/**/*.stories.js", | ||
"../src/**/*.stories.jsx", | ||
"../src/**/*.stories.tsx", | ||
"../src/**/*.stories.mdx", | ||
"*.ts", | ||
"*.js" | ||
] | ||
} |
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,55 @@ | ||
import * as React from 'react'; | ||
import {TokenGrid} from './TokenGrid'; | ||
|
||
export interface ColorSwatch { | ||
value: string; | ||
varName: string; | ||
} | ||
|
||
/** builds color swatch objects for ColorGrid */ | ||
export function buildColorSwatch(varName: string): ColorSwatch { | ||
// Get the CSS var's value from the :root element | ||
const value = getComputedStyle(document.documentElement).getPropertyValue(varName); | ||
return { | ||
value, | ||
varName, | ||
}; | ||
} | ||
|
||
interface ColorGridProps { | ||
name: string; | ||
palette: ColorSwatch[]; | ||
} | ||
|
||
/** transform 'camelCase' names into 'spaced case' */ | ||
function formatName(name: string) { | ||
return name | ||
.split(/(?=[A-Z])/) | ||
.join(' ') | ||
.toLowerCase(); | ||
} | ||
|
||
/** A configuration of TokenGrid to quickly build tables for colors */ | ||
export function ColorGrid(props: ColorGridProps) { | ||
return ( | ||
<TokenGrid | ||
caption={formatName(props.name)} | ||
headings={['Swatch', 'CSS Variable', 'Value']} | ||
rows={props.palette} | ||
> | ||
{token => ( | ||
<> | ||
<TokenGrid.RowItem> | ||
<TokenGrid.Swatch style={{backgroundColor: `var(${token.varName})`}} /> | ||
</TokenGrid.RowItem> | ||
<TokenGrid.RowItem> | ||
<TokenGrid.MonospaceLabel>{token.varName}</TokenGrid.MonospaceLabel> | ||
</TokenGrid.RowItem> | ||
<TokenGrid.RowItem> | ||
<TokenGrid.MonospaceLabel>{token.value}</TokenGrid.MonospaceLabel> | ||
</TokenGrid.RowItem> | ||
</> | ||
)} | ||
</TokenGrid> | ||
); | ||
} |
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 @@ | ||
.stack { | ||
display: grid; | ||
gap: 2rem; | ||
} |
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,10 @@ | ||
import React from 'react'; | ||
import './index.css'; | ||
|
||
interface StackProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
export function Stack({children}: StackProps) { | ||
return <div className="stack">{children}</div>; | ||
} |
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,82 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans&family=Roboto+Mono&family=Roboto:wght@300;400;500;700&display=swap'); | ||
|
||
* { | ||
box-sizing: border-box; | ||
font-family: Roboto; | ||
} | ||
|
||
.token-grid { | ||
border: solid 1px var(--cnvs-base-palette-soap-500); | ||
border-radius: 0.5rem; | ||
display: grid; | ||
min-width: 48rem; | ||
max-width: 64rem; | ||
overflow-x: auto; | ||
} | ||
|
||
.token-grid__caption { | ||
border-bottom: solid 0.0625rem var(--cnvs-base-palette-soap-500); | ||
display: flex; | ||
padding: 0.5rem 1rem; | ||
text-transform: capitalize; | ||
} | ||
|
||
.token-grid__head { | ||
background-color: var(--cnvs-base-palette-soap-100); | ||
display: grid; | ||
} | ||
|
||
.token-grid__head-item { | ||
display: grid; | ||
color: var(--cnvs-base-palette-black-pepper-300); | ||
align-items: center; | ||
justify-content: start; | ||
font-weight: var(--cnvs-base-font-weight-700); | ||
} | ||
|
||
.token-grid__row { | ||
align-items: center; | ||
border-bottom: solid 0.0625rem var(--cnvs-base-palette-soap-500); | ||
display: grid; | ||
gap: 1rem; | ||
grid-auto-flow: column; | ||
grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); | ||
min-height: 4rem; | ||
padding: 1rem; | ||
justify-content: start; | ||
} | ||
|
||
.token-grid__body .token-grid__row:last-of-type { | ||
border-bottom: none; | ||
} | ||
|
||
.token-grid__row-item { | ||
align-items: start; | ||
display: grid; | ||
gap: 0.25rem; | ||
justify-self: start; | ||
} | ||
|
||
.token-grid__swatch { | ||
display: grid; | ||
grid-template-columns: minmax(2rem, 8rem); | ||
height: 2rem; | ||
padding: 0.5rem; | ||
border: 0.0625rem solid var(--cnvs-base-palette-soap-500); | ||
} | ||
|
||
.token-grid__sample { | ||
background-color: var(--cnvs-base-palette-french-vanilla-100);; | ||
display: grid; | ||
grid-template-columns: minmax(2rem, 8rem); | ||
height: 2rem; | ||
width: 2rem; | ||
} | ||
|
||
.token-grid__monospace-label { | ||
background-color: var(--cnvs-base-palette-soap-200); | ||
font-family: 'Roboto Mono'; | ||
padding: 0.25rem; | ||
border-radius: 0.25rem; | ||
min-height: 1rem; | ||
} |
Oops, something went wrong.