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

Style: css tokens #85

Merged
merged 11 commits into from
Jan 26, 2024
Merged

Style: css tokens #85

merged 11 commits into from
Jan 26, 2024

Conversation

jared-dickman
Copy link
Collaborator

Instructions

  1. PR target branch should be against main
  2. PR title name should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-title-check.yml
  3. PR branch prefix should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-branch-check-name.yml

Summary

  • Bring all ant tokens in as css vars
  • currently a manual process to copy/paste generated GlobalToken into the json file..

Testing Plan

  • Was this tested locally? If not, explain why.
  • {explain how this has been tested, and what, if any, additional testing should be done}

Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)

@@ -75,7 +76,8 @@
"build-dist": "sh ./scripts/build-dist.sh",
"build-storybook": "storybook build",
"lint": "eslint --ext .ts,.tsx \"src/**/*.{ts,tsx}\"",
"lint:fix": "eslint --ext .ts,.tsx \"src/**/*.{ts,tsx}\" --quiet --fix"
"lint:fix": "eslint --ext .ts,.tsx \"src/**/*.{ts,tsx}\" --quiet --fix",
"tokens-to-css": "npx style-dictionary build --config ./style-dictionary.json"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

bringing back the recently removed code 😮‍💨

@@ -1,6 +1,498 @@
:root {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is the generated file

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

@@ -0,0 +1,29 @@
// From https://ant.design/docs/react/customize-theme
// Run this script and copy the globalToken into /design/GlobalToken.json

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

currently its a little hacky to run this, im copy/pasting it into the button story, so that the code runs inside the ant context.
if you have an idea [that only takes ~ 5 mins to implement] its worth a shot to make this more push-button-get-json

Copy link
Collaborator

Choose a reason for hiding this comment

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

Tried some alternatives with using npx ts-node or compiling the code with tsc and running it through Node but none of them worked seamlessly, so I guess we keep using the copy approach

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i do have one more idea, creating a story that runs the code. perhaps then chromatic would alert on changes in design tokens as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🎉
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

Copy link
Collaborator

Choose a reason for hiding this comment

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

praise docs 👏🏼

Copy link
Collaborator

@tibuurcio tibuurcio left a comment

Choose a reason for hiding this comment

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

lgtm


const globalToken = wrapValuesInObject(getDesignToken(useTheme()))

return <>{JSON.stringify(globalToken, null, 1)}</>
Copy link
Collaborator

@tibuurcio tibuurcio Jan 26, 2024

Choose a reason for hiding this comment

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

tried wrapping on <pre><code></code></pre> but it didn't work well 😞

@jared-dickman jared-dickman merged commit 8dcdd14 into main Jan 26, 2024
Copy link

github-actions bot commented Feb 6, 2024

🎉 This PR is included in version 1.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants