designsystemet icon indicating copy to clipboard operation
designsystemet copied to clipboard

"Component tokens" component

Open mimarz opened this issue 5 months ago • 2 comments

Make an internal component that automates documentation of a components "component tokens" to be used in Storybook (and Storefront in the future).

Notes:

  • Use postcss plugins in js to parse our css
  • Let import do the work and pass the content to the component
  • List all CSS variables in a table
  • Maybe support comments in code thats also interpreted?

Something along the lines of: Input CSS:


.ds-button {
  --dsc-button-background--active: var(--ds-color-accent-base-active); /** Button background */
  …
}

Component use:

import css from '@digidr/designsystemet-css/button'

<ComponentTokens css={css} />

Rendered table:

Token Description Value
--dsc-button-background--active Button background var(--ds-color-accent-base-active)

mimarz avatar Sep 25 '24 07:09 mimarz