Theme Configuration
- To get the default value of theme scheme or direction , theme color go to the src/store/setting/state.ts
Theme Scheme Direction
- Property: "theme_scheme_direction"
- Choices: 'ltr' (left-to-right), 'rtl' (right-to-left)
Example
"theme_scheme_direction": {
"value": "ltr"
},
Theme Color
- Property: "theme_scheme_direction"
- Choices: "dark","hotstar","amazonprime","hulu"
Example
"theme_color": {
"value": "dark"
},
To get the current value of the following you can use:
- First import useSelector from react-redux.
- import the selectors files from src/store/setting/selectors in your component.
- import this file as top of your component using following example code in your component.
import { useSelector } from "react-redux";
import * as SettingSelector from '../store/setting/selectors'
- Then use the following code in your component to get the current value.
theme_color
const themeColor = useSelector(SettingSelector.theme_color)
theme_scheme_direction
const themeSchemeDirection = useSelector(SettingSelector.theme_scheme_direction)
To use action you can use dispatch to update state.js
- First import usedispatch from react-redux.
- import the actions files from src/store/setting/actons in your component.
- import this file as top of your component using following example code in your component.
import { useDispatch } from "react-redux";
import { theme_color } from "../../../store/setting/actions";
- Then write the following code inside the function component for use of dispatch method inside your component.
theme_color
dispatch(theme_color(value))
theme_scheme_direction
dispatch(theme_scheme_direction(value))