Page MenuHomePhabricator

[web] introduce AppThemeWrapper
ClosedPublic

Authored by ginsu on Oct 24 2023, 12:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jul 29, 5:53 AM
Unknown Object (File)
Mon, Jul 29, 5:53 AM
Unknown Object (File)
Mon, Jul 29, 5:53 AM
Unknown Object (File)
Mon, Jul 29, 5:51 AM
Unknown Object (File)
Mon, Jul 29, 5:26 AM
Unknown Object (File)
Fri, Jul 26, 9:13 PM
Unknown Object (File)
Thu, Jul 18, 12:34 AM
Unknown Object (File)
Wed, Jul 17, 2:21 PM

Details

Summary

This diff introduces a new component that wraps the contents of the App component, and the job of this component is to update the data attribute based on what the activeTheme of the app is. The subsequent diff will introduce the css variable list that will use this data attribute to show dark or light mode color values

Sources I used to help me with this implementation:
https://css-tricks.com/easy-dark-mode-and-multiple-color-themes-in-react/
https://stackoverflow.com/questions/56300132/how-to-override-css-prefers-color-scheme-setting

Test Plan

Please see the demo video below where the theme of the app changes based on the activeTheme redux state

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ginsu edited the test plan for this revision. (Show Details)
ginsu added reviewers: atul, inka, rohan.
ginsu edited the test plan for this revision. (Show Details)
web/style.css
49

We need to add this here to prevent this from happening:

Screenshot 2023-10-24 at 3.30.23 PM.png (2×3 px, 719 KB)

atul added a subscriber: ted.

Looks good, small question inline about defaulting to light

web/app-theme-wrapper.react.js
16

Does this mean we're defaulting to light mode? Personally prefer light mode, but figure we'd be defaulting to dark mode?

CC @ashoat, @ted

This revision is now accepted and ready to land.Oct 24 2023, 3:20 PM
web/app-theme-wrapper.react.js
16

probably something I should have called out... but on native we default to light mode as well if activeTheme is not defined.

https://github.com/CommE2E/comm/blob/master/native/themes/colors.js#L254

Kept it the same here to be consistent across both platforms, but happy to change this if we think this is not the best option

ginsu edited the summary of this revision. (Show Details)

rebase before landing

This revision was automatically updated to reflect the committed changes.

We definitely should not be defaulting to a half-baked light mode implementation, but I assume this has been considered

probably something I should have called out... but on native we default to light mode as well if activeTheme is not defined.

https://github.com/CommE2E/comm/blob/master/native/themes/colors.js#L254

Kept it the same here to be consistent across both platforms, but happy to change this if we think this is not the best option

While this is true, defaultGlobalThemeInfo defaults to dark mode, which means the app defaults to dark mode. I assume we're doing the same on web?

While this is true, defaultGlobalThemeInfo defaults to dark mode, which means the app defaults to dark mode. I assume we're doing the same on web?

Yes that is correct https://github.com/CommE2E/comm/blob/master/lib/types/theme-types.js#L12-L19