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: option to reset theme to system settings #585

Merged
merged 17 commits into from
Feb 12, 2025

Conversation

peterpeterparker
Copy link
Member

@peterpeterparker peterpeterparker commented Feb 12, 2025

Motivation

In OISY, we would like to offer users the ability to select "System" in addition to Dark or Light. Technically, this means reverting the theme to its original value—removing it from local storage and deriving the theme store value from the system settings.

Changes

  • Add a function to get the theme from the system settings (matchMedia).
  • Add a function to applyTheme but, delete the item in the localStorage.
  • Add function resetToSystemSettings to store.
  • A bit unrelated (but not that much): we use the initial-value function directly in the initialization of the store, instead of creating it outside. I think it makes more sense since we do not want a static value when creating this store, but we want to capture the current theme.

Tests

Added a few tests for themeStore and initThemeStore.

@AntonioVentilii AntonioVentilii marked this pull request as ready for review February 12, 2025 09:07
@AntonioVentilii AntonioVentilii requested review from a team as code owners February 12, 2025 09:07
Copy link
Contributor

@yhabib yhabib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Left some non-blocking comments

@peterpeterparker peterpeterparker merged commit 4ba38aa into main Feb 12, 2025
9 checks passed
@peterpeterparker peterpeterparker deleted the feat/theme-reset-system-settings branch February 12, 2025 13:15
AntonioVentilii added a commit to dfinity/oisy-wallet that referenced this pull request Feb 12, 2025
# Motivation

Bumping `gix-components` to include new improvements of the themeStore
from dfinity/gix-components#585
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants