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

feat(ui-kit): add Design Tokens synchronization automation from Figma to UI Kit #165

Conversation

sashathor
Copy link
Contributor

@sashathor sashathor commented Jan 16, 2024

Description of changes

This PR resolves:

The sync process:

  1. Go to UI Style Guide in Figma.
  2. Export Style Variables as JSON by using variables2json plugin (set Color format to rgba in plugin's settings).
  3. Put the exported variables.json into the folder packages/ui-kit/src/themes/.
  4. Run yarn build from the root folder.

The sync process runs two scripts:

  1. Parser – this script automates the conversion of design tokens from a JSON file into SCSS and TypeScript files, parsing variables for colors, typography, and other properties to generate styles and type definitions.
  2. Validator – this script builds SASS files into CSS, recursively gathers all relevant CSS and SCSS files within specified directories, extracts custom CSS variables prefixed with --propel, and validates these variables across different theme directories to ensure consistency in design tokens.

The sync went well

Screenshot 2024-04-03 at 19 52 23

The sync reports missed variables

Screenshot 2024-04-03 at 19 59 24

Checklist

Before merging to main:

  • Tests
  • Manually tested in React apps
  • Changesets
  • Approved

Copy link

changeset-bot bot commented Jan 16, 2024

🦋 Changeset detected

Latest commit: f808593

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@propeldata/ui-kit Patch
dashboard-example Patch
react-16 Patch
react-18 Patch
react-17 Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jan 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ui-kit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2024 1:47pm

@sashathor sashathor force-pushed the sasha/chore/PRO-2638/sync-ui-kit-design-tokens-with-latest-updates-in-figma branch from 33c323c to 270935b Compare February 26, 2024 13:38
@sashathor sashathor force-pushed the sasha/chore/PRO-2638/sync-ui-kit-design-tokens-with-latest-updates-in-figma branch from cde2b16 to 42a99df Compare February 29, 2024 09:46
@sashathor sashathor force-pushed the sasha/chore/PRO-2638/sync-ui-kit-design-tokens-with-latest-updates-in-figma branch from 7301139 to c4c3161 Compare April 3, 2024 18:23
@sashathor sashathor changed the title WIP: feat(ui-kit): add Design Tokens synchronization automation from Figma to UI Kit feat(ui-kit): add Design Tokens synchronization automation from Figma to UI Kit Apr 4, 2024
@sashathor sashathor marked this pull request as ready for review April 4, 2024 13:42
Copy link
Contributor

@felipecadavid felipecadavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! I just added a few comments, I also think it would be nice to add tests to the scripts

packages/ui-kit/rollup.config.js Show resolved Hide resolved
packages/ui-kit/scripts/parse-design-tokens.mts Outdated Show resolved Hide resolved
packages/ui-kit/scripts/parse-design-tokens.mts Outdated Show resolved Hide resolved
packages/ui-kit/scripts/parse-design-tokens.mts Outdated Show resolved Hide resolved
@sashathor
Copy link
Contributor Author

Overall looks good! I just added a few comments, I also think it would be nice to add tests to the scripts

I'm not 100% satisfied with the sync architecture 🤔. I have a strong feeling that it could be better. I plan to continue thinking on that during the syncing process in #206. We can also introduce the tests in that PR.

@sashathor sashathor force-pushed the sasha/chore/PRO-2638/sync-ui-kit-design-tokens-with-latest-updates-in-figma branch from eae7d98 to f808593 Compare April 5, 2024 13:43
@felipecadavid
Copy link
Contributor

I'm not 100% satisfied with the sync architecture 🤔. I have a strong feeling that it could be better. I plan to continue thinking on that during the syncing process in #206. We can also introduce the tests in that PR.

Cool, ideally we find a way to get the variables.json file automatically, maybe we can check figma's apis? Anyways, I think for now this will work nicely for our needs

@sashathor sashathor merged commit f3c3acb into main Apr 5, 2024
3 checks passed
@sashathor sashathor deleted the sasha/chore/PRO-2638/sync-ui-kit-design-tokens-with-latest-updates-in-figma branch April 5, 2024 13:58
@sashathor
Copy link
Contributor Author

I'm not 100% satisfied with the sync architecture 🤔. I have a strong feeling that it could be better. I plan to continue thinking on that during the syncing process in #206. We can also introduce the tests in that PR.

Cool, ideally we find a way to get the variables.json file automatically, maybe we can check figma's apis? Anyways, I think for now this will work nicely for our needs

@felipecadavid I planned to use Figma's API in the next stage because it requires a paid Enterprise plan for exporting variables:

To use this API, you must have a full seat in an Enterprise org; guests cannot use the API. The following table describes the requirements.

@sashathor sashathor mentioned this pull request Apr 18, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants