-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 52 - add theming #104
Conversation
7429d12
to
9123078
Compare
99ae194
to
c696864
Compare
71f7e5f
to
6ab34f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far.
I think I may not have understood what all the listeners were for, that could be either improved or just explained (commented) a little better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing picked up here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, functional, and most minor issues resolved.
The part around the setting the theme can be improved a bit, for example by using a context so that the computation of the theme state is only done once and can be used anywhere. And it would be great if it could handle theme changes originating from other tabs. But otherwise it's at least understandable how it is working. Any improvements there would be welcome.
toggle theme mode button use provider
f0d1880
to
ceca761
Compare
rename getDefaultBrowserTheme
bbb0922
to
c837bfb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great 👍
The provider holds the context well and the effects sync the tabs, localStorage, and DOM attributes well.
src/lib/themeProvider.tsx
Outdated
const themeProperty = '--default-theme'; | ||
|
||
interface ThemeContextType { | ||
setThemeMode: (theme: ThemeMode | null) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since ThemeMode | null
gets used many times it could be declared as a SavedThemeMode
type.
a1c64b6
to
2e34737
Compare
## [0.1.12](v0.1.11...v0.1.12) (2022-08-04) ### Features * 52 - add theming ([#104](#104)) ([eb86a72](eb86a72))
🎉 This PR is included in version 0.1.12 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
The main 3 css files of this PR contain a list of the sass variables that are affected by the current theme.
The sass properties get converted to css ones by the
props.scss
file.The
useThemeMode.ts
can get (+ hook) and save the theme mode.