-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 Add light/dark theme + custom theme switcher & update UI components…
… with new theme mode
- Loading branch information
Showing
21 changed files
with
537 additions
and
44 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,11 @@ | ||
import ThemeSwitcher from "./themeSwitcher"; | ||
|
||
const Settings = () => { | ||
return ( | ||
<nav className="fixed right-3 top-2 z-50 md:top-3"> | ||
<ThemeSwitcher /> | ||
</nav> | ||
); | ||
}; | ||
|
||
export default Settings; |
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,41 @@ | ||
import { type Theme, useTheme } from "@/theme/themeProvider"; | ||
import { MoonIcon, SunIcon } from "@/ui/icons/feather"; | ||
import { cn } from "@/utils"; | ||
|
||
const ThemeSwitcher = () => { | ||
const [theme, setTheme] = useTheme(); | ||
|
||
const buttons = [ | ||
{ | ||
label: "dark" as const, | ||
icon: <MoonIcon width={14} />, | ||
active: theme === "dark", | ||
}, | ||
{ | ||
label: "light" as const, | ||
icon: <SunIcon width={14} />, | ||
active: theme === "light", | ||
}, | ||
]; | ||
|
||
return ( | ||
<span className="flex w-fit items-center gap-0.5 overflow-hidden rounded-md border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-800/80"> | ||
{buttons.map(({ label, icon, active }) => ( | ||
<button | ||
type="button" | ||
title={`Switch to ${label} theme`} | ||
key={label} | ||
onClick={() => setTheme(() => label as Theme)} | ||
className={cn( | ||
"flex h-6 w-6 items-center justify-center rounded-none transition-all hover:opacity-50", | ||
active && "bg-zinc-200 dark:bg-zinc-900", | ||
)} | ||
> | ||
{icon} | ||
</button> | ||
))} | ||
</span> | ||
); | ||
}; | ||
|
||
export default ThemeSwitcher; |
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.