-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT]: Light Theme and Dark Theme Toggle (#437)
* feat: toogle theme * fix: correct theme button icons * style: light theme color * feat: change link_button styles * feat: add shadow to profile-card --------- Co-authored-by: Shyam Tawli <[email protected]>
- Loading branch information
1 parent
5652afe
commit 4e59cec
Showing
10 changed files
with
90 additions
and
22 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
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,19 @@ | ||
import { useState, useEffect } from 'react'; | ||
|
||
const useTheme = () => { | ||
const [theme, setTheme] = useState(localStorage.getItem('theme') || 'dark'); | ||
|
||
const toogleTheme = () => { | ||
const newTheme = theme === 'light' ? 'dark' : 'light'; | ||
setTheme(newTheme); | ||
localStorage.setItem('theme', newTheme); | ||
}; | ||
|
||
useEffect(() => { | ||
document.documentElement.className = theme; | ||
}, [theme]); | ||
|
||
return { theme, toogleTheme }; | ||
}; | ||
|
||
export default useTheme; |
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
4e59cec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
dev-find – ./
dev-find-git-master-shyamtawli3-gmailcom.vercel.app
dev-find.vercel.app
dev-find-shyamtawli3-gmailcom.vercel.app