Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

feat: adding data theme light attribute to stylesheet to provide dyna… #627

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

georgewrmarshall
Copy link
Collaborator

@georgewrmarshall georgewrmarshall commented Feb 16, 2024

Description

This PR addresses the need for flexible theme switching, as discussed in Issue #626. The motivation behind this change is to enhance user experience by allowing dynamic theme changes (light and dark modes) at any level of the application.

The solution involves updating our CSS to explicitly define light and dark mode variables and applying them using the data-theme attribute. This approach ensures that theme changes are seamlessly reflected across the application, regardless of the global theme setting.

Related issues

Fixes: #626

Manual testing steps

  1. Run storybook in the extension using yarn storybook
  2. Inspect the stylesheet of the design tokens and add ,[data-theme='light'] to root
  3. Test the theme switch at a component level by manually adding data-theme="light" or data-theme="dark" to component containers.

Screenshots/Recordings

After

Screencast below shows theming not work but once the data attribute [data-theme='light'] dynamic theming works

after1080.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • 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.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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 label Feb 16, 2024
@georgewrmarshall georgewrmarshall self-assigned this Feb 16, 2024
@georgewrmarshall georgewrmarshall marked this pull request as ready for review February 16, 2024 07:15
@georgewrmarshall georgewrmarshall requested a review from a team as a code owner February 16, 2024 07:15
@garrettbear garrettbear merged commit 2ca9e96 into main Feb 16, 2024
17 checks passed
@garrettbear garrettbear deleted the fix/626/data-theme-light branch February 16, 2024 15:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
team-design-system All issues relating to design system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Flexible Theme Switching with data-theme Attribute for Light and Dark Modes
3 participants