Settings
Learn how to store the user preferences.
Retrieving and setting the preferences
The settings-related actions are located in the src/stores/app.ts
directory.
These actions handle the process of setting the user preferences in the browser's local storage.
The provider of the preferences, located at components/providers/app-provider.tsx
, plays a crucial role in handling
user preferences and rendering the appropriate theme based on those preferences. Here's how it works:
On root layout initialization, the layout utilizes to retrieve the user's preferences from local storage. Based on the retrieved settings, the layout constructs the UI theme with the appropriate theme color and primary color. This ensures that the user's selected settings are applied consistently across the entire application.
How customize color variant
The list of color variant are located in src/config/color.ts
. you can add new color variant or modify existing color.
Add color variant
- Create new variant on configuration.
- Define css variable with format hsl on
src/styles/theme.css
by className.
- See in user preferences will be show new primary variant
Creating the theme based on preferences
Example
Create a React Client Component switch color button: