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

Conversation

@garrettbear
Copy link
Contributor

@garrettbear garrettbear commented Aug 21, 2024

Description

This PR introduces light and dark class names to CSS variables, associating them with [data-theme="light"] and [data-theme="dark"], respectively. These additions are crucial for enabling the use of CSS variables on mobile platforms and allow theme-specific styling to be applied at the component level. The light class is also necessary to apply a light theme to specific components while the overall theme is set to dark mode, ensuring consistent visual design across different scenarios.

Related issues

Fixes: #728

Manual testing steps

  1. Navigate to a page where theme variables are utilized.
  2. Switch between light and dark themes using the [data-theme] attribute.
  3. Apply the light and dark class names at the component level and verify that the styles are applied correctly.
  4. Confirm that the light class overrides the dark theme for specific components when in dark mode.

Screenshots/Recordings

Before

After

When testing in design-tokens repo you need to add a background default variable so that you can better see the change between light and dark mode. Example below
Screenshot 2024-08-22 at 1 55 03 PM

Video demonstrating data-theme="light", data-theme="dark", .light, and .dark working. Additionally using the class at component level.

Screen.Recording.2024-08-22.at.1.53.37.PM.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., pulled and built the branch, run the app, tested the 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.

@garrettbear garrettbear changed the title feat: add dark classname feat: add dark/light classname Aug 22, 2024
@garrettbear garrettbear marked this pull request as ready for review August 22, 2024 20:48
@garrettbear garrettbear requested a review from a team August 22, 2024 20:48
@metamaskbot
Copy link
Collaborator

Builds ready [7ac40d6]

Storybook: Storybook

Copy link
Collaborator

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@georgewrmarshall georgewrmarshall merged commit 35c3167 into main Sep 5, 2024
@georgewrmarshall georgewrmarshall deleted the feat/add-dark-classname branch September 5, 2024 15:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 'dark' class name to CSS

4 participants