feat(#3873): add dark mode theming with React context and Angular service#3874
feat(#3873): add dark mode theming with React context and Angular service#3874twjeffery wants to merge 11 commits into
Conversation
f6d7723 to
d3c0858
Compare
6a949ce to
7c13087
Compare
|
Preview links
Built from commit ee14e9d. Previews are removed automatically when this PR closes. |
e0da260 to
f053c07
Compare
9b15657 to
7683a4e
Compare
95e5d8a to
9338255
Compare
|
@Spark450 I addressed your comments, the preview link should be updated now. |
6309fdc to
6fb63a9
Compare
There was a problem hiding this comment.
| border-top: 1px solid var(--goa-color-greyscale-200); |
There's a couple other hard-coded values that we can address here too.
| ::placeholder { | ||
| /* Chrome, Firefox, Opera, Safari 10.1+ */ | ||
| color: #999; | ||
| opacity: 1; | ||
| /* Firefox */ | ||
| } | ||
|
|
||
| :-ms-input-placeholder { | ||
| /* Internet Explorer 10-11 */ | ||
| color: #999; | ||
| } | ||
|
|
||
| ::-ms-input-placeholder { | ||
| /* Microsoft Edge */ | ||
| color: #999; | ||
| } |
There was a problem hiding this comment.
| ::placeholder { | |
| /* Chrome, Firefox, Opera, Safari 10.1+ */ | |
| color: var(--goa-input-color-text-placeholder); | |
| opacity: 1; | |
| /* Firefox */ | |
| } | |
| :-ms-input-placeholder { | |
| /* Internet Explorer 10-11 */ | |
| color: var(--goa-input-color-text-placeholder); | |
| } | |
| ::-ms-input-placeholder { | |
| /* Microsoft Edge */ | |
| color: var(--goa-input-color-text-placeholder); | |
| } |
I'm not sure how often teams use standard input elements but we can use a token to ensure the placeholder colour looks good in dark mode.
…vice Co-authored-by: Thomas Jeffery <thomaswjeffery@gmail.com>
87d7a91 to
dbe5e00
Compare
| outline: var(--goa-link-gap-small, 3px) solid | ||
| var(--goa-color-interactive-focus); |
There was a problem hiding this comment.
| outline: var(--goa-link-gap-small, 3px) solid | |
| var(--goa-color-interactive-focus); | |
| outline: var(--goa-link-border-focus); |
We can use a link-specific token here.
bdfranck
left a comment
There was a problem hiding this comment.
I looked at the changes...
- ✅ The hardcoded values are replaced with tokens
- ✅ All the tokens are valid
Looks good! 👍 I have one more comment about a link token.
bdfranck
left a comment
There was a problem hiding this comment.
I looked at the latest changes and I see the link focus uses our design token. Looks good to me! 👍
| </div> | ||
|
|
||
| {/* Middle pages (after groups) */} | ||
| {MIDDLE_PAGES.map((page) => ( |
There was a problem hiding this comment.
MIDDLE_PAGES is never defined anywhere. This causes the side menu to disappear if Get Started is ever clicked.
| @@ -0,0 +1,62 @@ | |||
| --- | |||
There was a problem hiding this comment.
This page doesn't belong to the new Get Started collection, as such it isn't indexed for searching
| @@ -0,0 +1,267 @@ | |||
| --- | |||
Summary
Four small Svelte changes so dark mode can target colours that are currently hardcoded.
Changes
reset.css body background. Changed
#fffto reference--goa-color-greyscale-white.Dropdown native chevron. Replaced the pseudo-element chevron (hardcoded
#333stroke) with an inline SVG that follows--goa-dropdown-color-text. Same size and position as before.WorkSideMenu account popover background. Added
--goa-work-side-menu-account-bgso dark mode can give the popover its own background. Token is added in the design-tokens package in feat(#3873): add work-side-menu-account-bg token design-tokens#154.AppHeader and WorkSideMenu logos. Added dark variant SVGs and a MutationObserver on the
data-themeattribute so logos swap between light and dark when the theme changes.Note on the logo pattern
The logos use JS (a MutationObserver on the
data-themeattribute) to swap the<img src>between light and dark variants. The rest of the dark mode story is pure CSS cascade. This inconsistency is intentional for now: multi-colour branded imagery doesn't convert cleanly tocurrentColor-based inline SVG, and a proper refactor would be significantly larger. Happy to discuss a cleaner pattern in a follow-up if the team prefers.Context
Companion to #3850 (dark mode spike). The spike covered most of dark mode through token overrides. These changes address the shadow-DOM gaps the cascade can't reach.
How to test
npm installnpx nx serve react-prsdocument.documentElement.setAttribute('data-theme', 'dark'). AppHeader and WorkSideMenu logos swap. Run with'light'to swap back.Fixes #3873