cunningham icon indicating copy to clipboard operation
cunningham copied to clipboard

FInd a way to keep in sync design tokens doc with `tokens.ts`

Open NathanVss opened this issue 2 years ago • 1 comments

At the moment, for each component we need to manually define a Design tokens doc part and to make sure we exhaustively list and explain all available tokens defined in tokens.ts.

What I propose is to write a script in some way that parses tokens.ts and generate the Design tokens doc part, to achieve that we would maybe need to define descriptions of design tokens in comments like that:

import { DefaultTokens } from "@openfun/cunningham-tokens";

export const tokens = (defaults: DefaultTokens) => ({
  // Color of the background
  "accent-color": defaults.theme.colors["success-600"],
  // Color of the background
  "rail-background-color": defaults.theme.colors["greyscale-500"],
});

NathanVss avatar May 17 '23 12:05 NathanVss

I would really appreciate this feature 🤗

lebaudantoine avatar Jun 05 '23 09:06 lebaudantoine