-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Light and dark mode can now be toggled with a new button. New colors were also added to the site's theme to be more pearlike.
- Loading branch information
1 parent
b7367f8
commit 28e0038
Showing
9 changed files
with
825 additions
and
195 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,22 @@ | ||
import React, { useState } from 'react'; | ||
import { FaSun, FaMoon } from "react-icons/fa"; | ||
|
||
import '../styles/view.css'; | ||
|
||
|
||
const ThemeToggle: React.FC = () => { | ||
const [theme, setTheme] = useState("dark"); | ||
const toggleTheme = () => { | ||
setTheme(theme === 'dark' ? 'light' : 'dark'); | ||
document.documentElement.setAttribute("data-theme", theme); | ||
} | ||
return ( | ||
<> | ||
<button onClick={toggleTheme} style={{fontSize: '1.2rem', position: "absolute", top: "1rem", right: "1rem"}}> | ||
{theme === 'dark' ? <FaSun/>:<FaMoon/>} | ||
</button> | ||
</> | ||
); | ||
}; | ||
|
||
export default ThemeToggle; |
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.