Skip to content
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

Merged
merged 8 commits into from
Aug 4, 2022
Merged

feat: 52 - add theming #104

merged 8 commits into from
Aug 4, 2022

Conversation

nickzoum
Copy link
Contributor

@nickzoum nickzoum commented Aug 3, 2022

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.

@nickzoum nickzoum linked an issue Aug 3, 2022 that may be closed by this pull request
@nickzoum nickzoum self-assigned this Aug 3, 2022
@nickzoum nickzoum added enhancement New feature or request deploy preview labels Aug 3, 2022
@nickzoum nickzoum added this to the Base milestone Aug 3, 2022
@duality-labs duality-labs deleted a comment from github-actions bot Aug 3, 2022
@duality-labs duality-labs deleted a comment from github-actions bot Aug 3, 2022
@nickzoum nickzoum requested a review from dib542 August 3, 2022 18:58
Copy link
Collaborator

@dib542 dib542 left a 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.

src/lib/useThemeMode.ts Outdated Show resolved Hide resolved
src/lib/useThemeMode.ts Outdated Show resolved Hide resolved
src/lib/useThemeMode.ts Outdated Show resolved Hide resolved
src/scss/theme/props.scss Outdated Show resolved Hide resolved
src/scss/theme/props.scss Outdated Show resolved Hide resolved
Copy link
Collaborator

@dib542 dib542 left a 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

src/lib/useThemeMode.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@dib542 dib542 left a 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.

Copy link
Collaborator

@dib542 dib542 left a 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.

const themeProperty = '--default-theme';

interface ThemeContextType {
setThemeMode: (theme: ThemeMode | null) => void;
Copy link
Collaborator

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.

@nickzoum nickzoum merged commit eb86a72 into main Aug 4, 2022
@nickzoum nickzoum deleted the 52-add-theming branch August 4, 2022 18:56
dib542 pushed a commit that referenced this pull request Aug 4, 2022
## [0.1.12](v0.1.11...v0.1.12) (2022-08-04)

### Features

* 52 - add theming ([#104](#104)) ([eb86a72](eb86a72))
@dib542
Copy link
Collaborator

dib542 commented Aug 4, 2022

🎉 This PR is included in version 0.1.12 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@dib542 dib542 added the released label Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add theming
2 participants