chore: upgrading to design tokens v4#24953
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
e9c8431 to
c155149
Compare
583de3c to
dadff43
Compare
|
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@metamask/design-tokens@3.0.0 |
428ae98 to
b376466
Compare
.storybook/4.SHADOW.stories.mdx
Outdated
There was a problem hiding this comment.
In design tokens v4, --color-primary-shadow and --color-error-shadow were changed to --color-shadow-primary and --color-shadow-error. All instances have been replaced, and primary and error shadows still work.
From the design tokens v4 Migration docs:
No instances of deprecated shadow CSS variables remain in the codebase.
Screenshot shows primary and error shadows still working after v4 upgrade:
ui/css/utilities/colors.scss
Outdated
There was a problem hiding this comment.
These third party network colors have been removed from v4 of the design tokens. There was some previous thoughts that we could manage test network colors within the MetaMask brand as test networks generally don't have any branding elements attached, but ultimately they are third party entities and should be treated as such. We should treat test networks the same as other networks and use images (even if we are the ones creating those images). Eventually these should be replaced.
From design tokens v4 migration docs
I have created a ticket to remove these colors, as they are third-party colors, not widely used, and unlikely to affect the brand evolution. It's low priority: #24969
Move this to the design token v4 branch so we can ensure that they are still working in that PR
Network colors still work after upgrade
ui/css/utilities/colors.scss
Outdated
There was a problem hiding this comment.
Moved above deprecated network colors
ui/css/utilities/colors.scss
Outdated
There was a problem hiding this comment.
Moved up from bottom of the file to before deprecated message
ui/components/ui/button/buttons.scss
Outdated
There was a problem hiding this comment.
After
Shadows still work as expected in deprecated button component
after.mov
| style={{ | ||
| textAlign: 'center', | ||
| backgroundColor: 'var(--brand-colors-white-white000)', | ||
| backgroundColor: 'var(--brand-colors-white)', |
There was a problem hiding this comment.
After
Background color to image still works as expected
after.mov
| var(--brand-colors-white) | ||
| var(--brand-colors-black) | ||
| var(--brand-colors-grey-grey800) |
There was a problem hiding this comment.
Updating docs to reflect correct tokens
| **/ | ||
| .card { | ||
| background-color: var(--brand-colors-white-white000); | ||
| background-color: var(--brand-colors-white); |
There was a problem hiding this comment.
Updating to correct token in docs
| height: 20px; | ||
| background-color: var(--brand-colors-white-white000); | ||
| background-color: var(--brand-colors-white); | ||
| padding: 1px; |
| &__body { | ||
| color: var(--brand-colors-white-white000); | ||
| color: var(--brand-colors-white); | ||
| width: 80%; |
| @media (prefers-color-scheme: dark) { | ||
| &:not([data-theme]) { | ||
| color: var(--brand-colors-white-white000); | ||
| color: var(--brand-colors-white); |
There was a problem hiding this comment.
This seems like the default font color for prefers color scheme dark. Check before/after screenshot of description as settings for that recording are set to system, and my system is set to dark
| background: var(--brand-colors-blue-blue500); | ||
| color: var(--brand-colors-white-white000); | ||
| color: var(--brand-colors-white); | ||
| padding: 3px 6px; |
There was a problem hiding this comment.
should this be using a themed token instead?
There was a problem hiding this comment.
Good question! I think originally it used brand colors here because the designer wanted the text to remain white but it would look strange once we update the colors so I'll update to theme. Updated here ddaeba1
|
Thanks for annotating the changes so it's easier to review |
e896a84
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #24953 +/- ##
========================================
Coverage 65.61% 65.61%
========================================
Files 1365 1365
Lines 54224 54224
Branches 14180 14180
========================================
Hits 35576 35576
Misses 18648 18648 ☔ View full report in Codecov by Sentry. |
Builds ready [e896a84]
Page Load Metrics (144 ± 182 ms)
Bundle size diffs
|












Description
This pull request aims to upgrade the extension to design tokens v4. This upgrade ensures the most up-to-date colors are being used that align with design and primes the extension for the upcoming brand evolution. Included in this PR are third-party network color CSS variables that have been removed from the design tokens package and renamed CSS variables for shadow. This PR is the final update from a series of PRs that replace deprecated CSS colors that have been removed in v4.
Dependency PRs that should be merged before this one:
Related issues
Fixes: #24916
Manual testing steps
Check all removed and changed CSS variables are no longer in the codebase:
node searchDeprecatedTokens.js.Check shadows and network colors work as expected:
Navigate to stories that use primary and error shadows (
ButtonPrimary,ButtonSecondary,Button(deprecated)) as well as network colors (BoxBackgroundColors story).Verify that shadows and network colors work as expected.
Run the extension and navigate around to ensure colors work as expected:
Pull this branch.
Run
yarn start.Navigate around the extension in light and dark mode to ensure colors work as expected.
Screenshots/Recordings
Before
Checking the codebase for any existing deprecated colors returns many results in the
developbranch.before720.mov
After
Checking the codebase for any deprecated removed colors that could break the UI using the provided script, after removing network colors, returns no results.
script.after720.mov
Checking components that use updated CSS variables and newly added still work as expected
after720.mov
Checking extension colors are working as expected in light and dark mode. In dark mode primary and error are a shade lighter in v4
after.app720.mov
Pre-merge author checklist
Pre-merge reviewer checklist