Skip to content

chore: upgrading to design tokens v4#24953

Merged
georgewrmarshall merged 12 commits intodevelopfrom
upgrade/design-tokens-v4
Jun 11, 2024
Merged

chore: upgrading to design tokens v4#24953
georgewrmarshall merged 12 commits intodevelopfrom
upgrade/design-tokens-v4

Conversation

@georgewrmarshall
Copy link
Copy Markdown
Contributor

@georgewrmarshall georgewrmarshall commented May 31, 2024

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:

Open in GitHub Codespaces

image

image (1)

Related issues

Fixes: #24916

Manual testing steps

Check all removed and changed CSS variables are no longer in the codebase:

  1. Pull this branch.
  2. Copy this script that checks for all deprecated colors to the root of the extension.
  3. Run node searchDeprecatedTokens.js.
  4. Ensure there are no results.

Check shadows and network colors work as expected:

  1. Navigate to stories that use primary and error shadows (ButtonPrimary, ButtonSecondary, Button (deprecated)) as well as network colors (Box BackgroundColors story).

  2. Verify that shadows and network colors work as expected.
    Run the extension and navigate around to ensure colors work as expected:

  3. Pull this branch.

  4. Run yarn start.

  5. 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 develop branch.

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

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@georgewrmarshall georgewrmarshall added DO-NOT-MERGE Pull requests that should not be merged team-design-system All issues relating to design system in Extension labels May 31, 2024
@georgewrmarshall georgewrmarshall self-assigned this May 31, 2024
@github-actions
Copy link
Copy Markdown
Contributor

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.

@georgewrmarshall georgewrmarshall force-pushed the upgrade/design-tokens-v4 branch from e9c8431 to c155149 Compare May 31, 2024 19:45
@georgewrmarshall georgewrmarshall force-pushed the upgrade/design-tokens-v4 branch 2 times, most recently from 583de3c to dadff43 Compare June 7, 2024 20:28
@socket-security
Copy link
Copy Markdown

socket-security bot commented Jun 7, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/design-tokens@4.0.0 None 0 227 kB metamaskbot

🚮 Removed packages: npm/@metamask/design-tokens@3.0.0

View full report↗︎

@georgewrmarshall georgewrmarshall changed the title chore: removing deprecated colors for design tokens v4 upgrade chore: upgrading to design tokens v4 Jun 7, 2024
@georgewrmarshall georgewrmarshall force-pushed the upgrade/design-tokens-v4 branch from 428ae98 to b376466 Compare June 10, 2024 03:47
Comment on lines 147 to 148
Copy link
Copy Markdown
Contributor Author

@georgewrmarshall georgewrmarshall Jun 10, 2024

Choose a reason for hiding this comment

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

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:

Screenshot 2024-06-09 at 8 57 43 PM

No instances of deprecated shadow CSS variables remain in the codebase.

Screenshot 2024-06-09 at 8 59 20 PM
Screenshot 2024-06-09 at 9 00 32 PM

Screenshot shows primary and error shadows still working after v4 upgrade:

Screenshot 2024-06-09 at 9 06 17 PM
Screenshot 2024-06-09 at 9 07 06 PM

Copy link
Copy Markdown
Contributor Author

@georgewrmarshall georgewrmarshall Jun 10, 2024

Choose a reason for hiding this comment

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

Screenshot shows shadows still working after v4 upgrade:

Screenshot 2024-06-09 at 9 06 17 PM
Screenshot 2024-06-09 at 9 07 06 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Screenshot shows shadows still working after v4 upgrade:

Screenshot 2024-06-09 at 9 24 40 PM Screenshot 2024-06-09 at 9 25 28 PM

Comment on lines 15 to 22
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Screenshot 2024-06-09 at 9 11 11 PM

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

Screenshot 2024-06-09 at 9 13 52 PM

Comment on lines 18 to 20
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved above deprecated network colors

Comment on lines 12 to 14
Copy link
Copy Markdown
Contributor Author

@georgewrmarshall georgewrmarshall Jun 10, 2024

Choose a reason for hiding this comment

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

Moved up from bottom of the file to before deprecated message

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After

Shadows still work as expected in deprecated button component

after.mov

@georgewrmarshall georgewrmarshall removed the DO-NOT-MERGE Pull requests that should not be merged label Jun 10, 2024
style={{
textAlign: 'center',
backgroundColor: 'var(--brand-colors-white-white000)',
backgroundColor: 'var(--brand-colors-white)',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After

Background color to image still works as expected

after.mov

Comment on lines +39 to +41
var(--brand-colors-white)
var(--brand-colors-black)
var(--brand-colors-grey-grey800)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updating docs to reflect correct tokens

**/
.card {
background-color: var(--brand-colors-white-white000);
background-color: var(--brand-colors-white);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updating to correct token in docs

height: 20px;
background-color: var(--brand-colors-white-white000);
background-color: var(--brand-colors-white);
padding: 1px;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After

Background of custody logo is white

Screenshot 2024-06-10 at 3 13 42 PM Screenshot 2024-06-10 at 3 13 46 PM

&__body {
color: var(--brand-colors-white-white000);
color: var(--brand-colors-white);
width: 80%;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After

Ramps card text and button remain white

Screenshot 2024-06-10 at 3 15 58 PM Screenshot 2024-06-10 at 3 16 19 PM

@media (prefers-color-scheme: dark) {
&:not([data-theme]) {
color: var(--brand-colors-white-white000);
color: var(--brand-colors-white);
Copy link
Copy Markdown
Contributor Author

@georgewrmarshall georgewrmarshall Jun 10, 2024

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After

Beta text remains white

Screenshot 2024-06-10 at 3 26 13 PM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be using a themed token instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Screenshot 2024-06-10 at 4 28 09 PM Screenshot 2024-06-10 at 4 28 35 PM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice!

Copy link
Copy Markdown
Contributor

@brianacnguyen brianacnguyen left a comment

Choose a reason for hiding this comment

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

1 small comment

brianacnguyen
brianacnguyen previously approved these changes Jun 10, 2024
@georgewrmarshall georgewrmarshall added the needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. label Jun 11, 2024
garrettbear
garrettbear previously approved these changes Jun 11, 2024
@bergeron
Copy link
Copy Markdown
Contributor

Thanks for annotating the changes so it's easier to review

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.61%. Comparing base (2b2ee43) to head (e896a84).

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.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [e896a84]
Page Load Metrics (144 ± 182 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint7512490136
domContentLoaded8171221
load401798144380182
domInteractive8171221
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 484 Bytes (0.01%)
  • common: 0 Bytes (0.00%)

@georgewrmarshall georgewrmarshall merged commit 8a04980 into develop Jun 11, 2024
@georgewrmarshall georgewrmarshall deleted the upgrade/design-tokens-v4 branch June 11, 2024 17:37
@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-design-system All issues relating to design system in Extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[EXT] Update design-tokens package to version 4.0.0

6 participants