Closed scotttjob closed 1 month ago
Latest commit: |
0a9c507
|
Status: | ✅ Deploy successful! |
Preview URL: | https://e5a1fcd7.atlantis.pages.dev |
Branch Preview URL: | https://scott-th-design-package-redo.atlantis.pages.dev |
Published Pre-release for 39d019bbdc2947eb146d3491289304bb62663371 with versions:
- @jobber/components@5.20.8-SCOTTTHd-39d019b.38+39d019bb
- @jobber/design@0.62.3-SCOTTTHd-39d019b.41+39d019bb
To install the new version(s) for Web run:
npm install @jobber/components@5.20.8-SCOTTTHd-39d019b.38+39d019bb @jobber/design@0.62.3-SCOTTTHd-39d019b.41+39d019bb
To install the new version(s) for Mobile run:
npm install @jobber/design@0.62.3-SCOTTTHd-39d019b.41+39d019bb
292 changed files??
I know I know! But but but:
The majority of those changes are:
If you collapse the icon + snapshot changes, you get a much smaller group of files to review (which are the actual changes). Pulling this branch down and trying it first-hand will also give a good idea of how it works in practice. Make sure to run
npm run clean
before swapping into this branch.Motivations
You changed the tokens?
Sure did!
We currently store our tokens as CSS files. This works very well on the web.
The problems crop up when you need those styles inside react-native (or somewhere else, like say, Figma). Now you have to go through a complicated process of running your css through postcss to generate values, then parse those CSS files into javascript objects.
Unfortunately, that process is the reverse of where the industry ended up.
The W3C even got in on trying to define how you define tokens.
This PR follows their spec. The spec is very, very close to the StyleDictionary format. The primary difference is the W3C format uses the dollar sign '$' character to denote control variables ($type, $description, $value) while the Style Dictionary format does not.
Above is an example of just about all the new token system features.
$value
for any particular object tree.{color:{base:{grey:{_:{100:{$value:'...'}}}}}}
Additional functionality:
{"color": {"green":{"$value":"#00EE11"}}
You can reference that in another token with{"color":{"interactive":"{color.green}"}}
. There are processing functions underpackages/design/src/scripts/tokenServices
that can process the tokens into a JS object, and then turn the aliases into either actual values, or css custom properties.Adding a new set of tokens to the complete package can be achieved by:
allTokens.ts
and adding it to the tokenMap in this file. At this point, your token contents should start showing up in all the built output vianpm run build
in the design package (or justnpm install
from the root)Why are there Storybook changes in here too?
To show off a compelling reason why we should try to land this PR. We've implemented dark mode in storybook in just a few lines of code, by pulling in the dark mode tokens created by the design package now. In theory this could be extended to new themes in just a few more lines of code.
Changes
:root{}
, js files in both CJS and EJS formats, and theme files.Added
Changed
Deprecated
Removed
Fixed
Security
Testing
Changes can be tested via Pre-release
In Atlantis we use Github's built in pull request reviews.