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

"Component tokens" component #2513

Closed
mimarz opened this issue Sep 25, 2024 · 2 comments · Fixed by #2626
Closed

"Component tokens" component #2513

mimarz opened this issue Sep 25, 2024 · 2 comments · Fixed by #2626
Assignees
Labels
documentation/code For documentation related to code and technical specifications react @digdir/designsystemet-react

Comments

@mimarz
Copy link
Collaborator

mimarz commented Sep 25, 2024

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 mimarz converted this from a draft issue Sep 25, 2024
@mimarz mimarz added documentation/code For documentation related to code and technical specifications react @digdir/designsystemet-react labels Sep 25, 2024
@Barsnes
Copy link
Member

Barsnes commented Sep 25, 2024

I like this, but we should probably filter on --dsc-, and mark our internal variables with something like --dsci- (i for internal`)

@eirikbacker
Copy link
Contributor

Agree! Like the concept - good work 💪 and marking internal is a good suggestion @Barsnes 🙌

@Barsnes Barsnes self-assigned this Oct 16, 2024
@Barsnes Barsnes moved this from 📄 Todo to 🏗 In progress in Team Design System Oct 16, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Team Design System Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation/code For documentation related to code and technical specifications react @digdir/designsystemet-react
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants