@stepzen/design-system
v0.3.0
Published
StepZen design system
Maintainers
Keywords
Readme
StepZen Design System
This npm package includes design tokens, styles and UI components shared across different StepZen web apps: the docs and marketing site stepzen.com, the "My Account" dashboard dashboard.stepzen.com, etc.
This repo includes Storybook as a tool to visualise the contents of the design system, making it available on the web.
The Storybook for the main branch is automatically published to https://main--62ba1d9d935e74836cf81cae.chromatic.com/.
NOTE: it might take up to an hour after a push to main before changes appear on https://main--62ba1d9d935e74836cf81cae.chromatic.com/.
How to use
In a NextJS app
- add an npm dependency:
npm install --save @stepzen/design-system - inlcude styles into the
pages/_app.jsimport "@stepzen/design-system/dist/css/index.css"; - That's it. Now you can access to the CSS custom properties, global styles and UI components from the StepZen design system in your
.cssand.js/.tsfiles.
Updating and publishing a new version
Manual publishing steps:
git clone [email protected]:steprz/design-system.git --depth 1cd design-systemnpm cinpm version [new version]npm run buildnpm publishgit push(to push the version commit)git push --tags(to push the new version tag)- create a GitHub release from the new version tag
- post a summary to the
#dev-products-frontendSlack channel
Adding a new global style
Global style sheets set CSS custom properties on the HTML page :root and / or modify styles of the standard HTML elements such as <h1> or <body>.
How to add a new global style to the StepZen design system:
- consider if it would make sense to append the new style to one of the existing
.cssfiles - if not, create a new
stylesheet-name.cssfile undersrc/styles(orsrc/styles/tokensfor new design tokens) - write CSS as usual, assuming it is loaded into apps by a regular
<link rel="stylesheet">tag - import the new .css file into
src/styles/index.csswith a relative@import() - create a
[StylesheetName].stories.mdxfile next to thestylesheet-name.cssfile (copy from one of the existing similar files) - update the
<Meta title="Design Tokens/Colors" />tag in the copied file appropriately - describe the new stylesheet so that other engineers on the StepZen team know what it is and how to use it
- publish a new version of the
@stepzen/design-systempackage to npm (most likely, this would be a minor) - That's it. All apps using the StepZen design system via
import '@stepzen/design-system/dist/css/index.css'will get new global styles after bumping the version of their@stepzen/design-systemnpm dependency.
Adding a new UI component
TBD
Currently, the design system only includes a dummy sample Button component which is not intended for actual usage.
Running locally
This repo uses NodeJS 16+ and npm 7+.
npm run build- (re)create a production design system bundle in thedist/folder (includes.css,.js, and.d.tsfiles)npm run storybook- start a local Storybook server on http://localhost:6006npm run build-storybook- create a production storybook bundle in thestorybook-static/foldernpx chromatic --project-token=<project-token>- recreate a production srotybook bundle and publish it tochromatic.com. Copy the project token from https://www.chromatic.com/manage?appId=62ba1d9d935e74836cf81cae&view=configure. Typically you do not need to do that, since all branches on GitHub are automatically deployed tochromatic.comby the "Chromatic" GitHub workflow (see.github/workflows/chromatic.yaml).
