-
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.
feat(theme): add theme toggle and fix light mode
- Loading branch information
1 parent
b642133
commit 3b99f1e
Showing
10 changed files
with
3,044 additions
and
18,187 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 was deleted.
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use client" | ||
|
||
import * as React from "react" | ||
import { useTheme } from "next-themes" | ||
|
||
import { Button } from "@/components/ui/button" | ||
import { Icons } from "@/components/icons" | ||
|
||
export function ThemeToggle() { | ||
const { theme } = useTheme() | ||
const { setTheme } = useTheme() | ||
|
||
const handleToggle = React.useCallback(() => { | ||
setTheme(theme === "light" ? "dark" : "light") | ||
}, [setTheme, theme]) | ||
|
||
return ( | ||
<Button | ||
variant="ghost" | ||
size="sm" | ||
className="h-8 w-8 px-0" | ||
onClick={handleToggle} | ||
> | ||
<Icons.sun className="rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" /> | ||
<Icons.moon className="absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" /> | ||
<span className="sr-only">Toggle theme</span> | ||
</Button> | ||
) | ||
} |
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.