-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INJIWEB-257]: injiweb theme customization (#44)
Signed-off-by: Vijay <[email protected]>
- Loading branch information
1 parent
a1b97d8
commit d14798c
Showing
29 changed files
with
376 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from "react"; | ||
import {MdDarkMode, MdLightMode} from "react-icons/md"; | ||
import {useDispatch, useSelector} from "react-redux"; | ||
import {RootState} from "../../types/redux"; | ||
import {storeTheme} from "../../redux/reducers/commonReducer"; | ||
import {storage} from "../../utils/storage"; | ||
|
||
export const Theme = { | ||
LIGHT: 'light', | ||
DARK: 'dark' | ||
} | ||
export const ThemeMode: React.FC = () => { | ||
const dispatch = useDispatch(); | ||
const theme = useSelector((state: RootState) => state.common.theme); | ||
const handleThemeChange = () => { | ||
const newTheme = theme === Theme.LIGHT ? Theme.DARK : Theme.LIGHT; | ||
dispatch(storeTheme(newTheme)); | ||
storage.setItem(storage.SELECTED_THEME, newTheme); | ||
} | ||
|
||
return <div onClick={handleThemeChange}> | ||
<div className={"p-2 w-20 h-10 rounded-full border-1 border-2 flex justify-center items-center"}> | ||
<div className={"w-8 h-8 rounded-full flex items-center justify-center"}> | ||
<MdLightMode size={25} color={theme === Theme.DARK ? "" : "orange"}/> | ||
</div> | ||
<div className={"w-8 h-8 rounded-full flex items-center justify-center"}> | ||
<MdDarkMode size={25} color={theme === Theme.DARK ? "blue" : ""}/> | ||
</div> | ||
</div> | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.