Conversation
Use CSS selector html.dark .b3-root to support next-themes
Summary of ChangesHello @nnti3n, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the dark theme implementation within the SDK to enhance compatibility with external theme management solutions, such as Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the dark theme implementation to rely on an html.dark class instead of a data-theme attribute on the SDK's root element. This is a good change that aligns with modern practices, for example with next-themes, and should resolve the flashing issue mentioned. The changes in StyleRoot.tsx and OrderHistory.tsx are correct. However, the refactoring in the CSS is incomplete. I've left a comment on a missed update in index.css that would lead to broken dark mode styles for modals.
packages/sdk/src/styles/index.css
Outdated
|
|
||
| html[data-theme="dark"] .b3-root, | ||
| .b3-root[data-theme="dark"] { | ||
| html.dark .b3-root { |
There was a problem hiding this comment.
While this change correctly updates the main dark theme selector, a related selector for modals on line 293 was missed: .b3-root[data-theme="dark"] .b3-modal. It still uses the old data-theme attribute, which will result in broken dark mode styles for modals.
To fix this, please update it to html.dark .b3-root .b3-modal to be consistent with the new theming approach.
Support multiple dark theme selectors: - html.dark .b3-root (next-themes with class attribute) - html[data-theme="dark"] .b3-root (next-themes with data attribute) - .b3-root[data-theme="dark"] (B3Provider theme prop) - .b3-root.dark (manual dark class)
Use CSS selector html.dark .b3-root to support next-themes
SDK Should not handle theme since it's too problematic (flashing dark/light on render)
[LINEAR_ISSUE_ID_HERE]
Description
Write a description.
Test Plan
Screenshots
For BE, include snippets, response payloads and/or curl commands to test endpoints
[FE] Before
[FE] After
[BE] Snippets/Response/Curl
automerge=false