Skip to content

chore: refactoring opacity tokens and removing and adding some colors#25158

Merged
georgewrmarshall merged 7 commits intodevelopfrom
fix/opacity-token
Jun 10, 2024
Merged

chore: refactoring opacity tokens and removing and adding some colors#25158
georgewrmarshall merged 7 commits intodevelopfrom
fix/opacity-token

Conversation

@georgewrmarshall
Copy link
Copy Markdown
Contributor

@georgewrmarshall georgewrmarshall commented Jun 7, 2024

Description

This pull request refactors the opacity token to be outside of the component-library folder, as it is used outside of the component library. Additionally, it removes some deprecated colors and re-adds missing overlay colors.

Reason for the change:
The opacity token is utilized beyond the scope of the component-library, so it needs to be accessible outside of this folder for better maintainability and usage consistency. Furthermore, removing deprecated colors and re-adding missing overlay colors ensures the codebase is clean and up-to-date with the latest design requirements.

Open in GitHub Codespaces

Related issues

Part of: #24916

Manual testing steps

  1. Navigate to the Button component in storybook.
  2. Check disabled control and check opacity token still works
  3. Check codebase for instances of success-alternative, infoDisabled, and info-disabled to ensure none remain

Screenshots/Recordings

Before after screenshots in the code comments for easier review

Pre-merge author checklist

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 the team-design-system All issues relating to design system in Extension label Jun 7, 2024
@georgewrmarshall georgewrmarshall self-assigned this Jun 7, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 7, 2024

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.

Comment on lines -8 to -12
// Temp CSS Variables
:root {
--opacity-disabled: 0.5;
}

Copy link
Copy Markdown
Contributor Author

@georgewrmarshall georgewrmarshall Jun 7, 2024

Choose a reason for hiding this comment

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

Moved to opacity.scss as it's now used outside of the component-library components, so it makes sense to place it in the extension global styles folder: https://github.com/MetaMask/metamask-extension/pull/25158/files#diff-0bee63110d632972bcb15aeea3a018010055fb4c48040c989dfc7dbc329e4876

infoDefault = 'info-default',
infoMuted = 'info-muted',
infoInverse = 'info-inverse',
infoDisabled = 'info-disabled',
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.

Must have been a bad merge but infoDisabled no longer exists in the codebase

Screenshot 2024-06-07 at 4 03 35 PM

// Temp CSS Variables
:root {
--opacity-disabled: 0.5;
}
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.

Opacity token still work as expected after refactoring

Screenshot 2024-06-07 at 4 04 44 PM

@import './utilities/fonts.scss';
@import './utilities/pending-colors.scss';
@import './utilities/colors.scss';
@import './utilities/opacity.scss';
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.

Importing opacity stylesheet in index.css

'info-default': --color-info-default,
'info-muted': --color-info-muted,
'info-inverse': --color-info-inverse,
'info-disabled': --color-info-disabled,
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.

Must have been a bad merge info-disabled no longer exists in the codebase

Screenshot 2024-06-07 at 4 06 04 PM

'warning-muted': --color-warning-muted,
'warning-inverse': --color-warning-inverse,
'success-default': --color-success-default,
'success-alternative': --color-success-alternative,
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.

Must have been a bad merge success-alternative no longer exists in the codebase

Screenshot 2024-06-07 at 4 06 48 PM

var(--color-info-muted)
var(--color-info-inverse)
var(--color-info-disabled) [DEPRECATED]
```
Copy link
Copy Markdown
Contributor Author

@georgewrmarshall georgewrmarshall Jun 7, 2024

Choose a reason for hiding this comment

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

Updating docs to remove deprecated CSS variables. No instances of color-info-disabled remain.

Screenshot 2024-06-09 at 8 17 13 PM

@georgewrmarshall georgewrmarshall marked this pull request as ready for review June 7, 2024 23:07
@georgewrmarshall georgewrmarshall requested review from a team as code owners June 7, 2024 23:07
Comment on lines +77 to +78
var(--color-overlay-alternative)
var(--color-overlay-inverse)
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.

Un-deprecating overlay/inverse as there are use cases and adding overlay/alternative. See CSS variables present in the design tokens stylesheet in this branch

Screenshot 2024-06-09 at 8 08 00 PM

Comment on lines +94 to +95
var(--color-error-default-hover)
var(--color-error-default-pressed)
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 CSS variables are present and allowed to be used. Updating the docs to reflect this.

Screenshot 2024-06-09 at 8 14 35 PM

Comment on lines +101 to +102
var(--color-warning-default-hover)
var(--color-warning-default-pressed)
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 CSS variables are present and allowed to be used. Updating the docs to reflect this.

Screenshot 2024-06-09 at 8 15 45 PM

Comment on lines +108 to +109
var(--color-success-default-hover)
var(--color-success-default-pressed)
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 CSS variables are present and allowed to be used. Updating the docs to reflect this.

Screenshot 2024-06-09 at 8 16 33 PM

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.64%. Comparing base (ddf0e93) to head (e64b050).
Report is 10 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25158      +/-   ##
===========================================
- Coverage    65.64%   65.64%   -0.00%     
===========================================
  Files         1362     1362              
  Lines        54151    54150       -1     
  Branches     14074    14074              
===========================================
- Hits         35546    35545       -1     
  Misses       18605    18605              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [e64b050]
Page Load Metrics (49 ± 5 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint671008194
domContentLoaded8311152
load417949105
domInteractive8311152
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: -31 Bytes (-0.00%)

@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 10, 2024
@georgewrmarshall georgewrmarshall merged commit 96fd08f into develop Jun 10, 2024
@georgewrmarshall georgewrmarshall deleted the fix/opacity-token branch June 10, 2024 21:58
@github-actions github-actions bot locked and limited conversation to collaborators Jun 10, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 10, 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.

4 participants