-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: dark mode * update * update * refactor: move to settings --------- Co-authored-by: DIYgod <i@diygod.me>
- Loading branch information
Showing
12 changed files
with
124 additions
and
43 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,14 @@ | ||
import { useDark } from "@renderer/hooks/useDark" | ||
|
||
import { Switch } from "./ui/switch" | ||
|
||
export function AppearanceSwitch() { | ||
const { toggleDark, isDark } = useDark() | ||
|
||
return ( | ||
<div className="flex items-center justify-between gap-4"> | ||
<p>Dark Mode</p> | ||
<Switch checked={isDark} onCheckedChange={toggleDark} /> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { useAtom } from "jotai" | ||
import { atomDark } from "jotai-dark" | ||
|
||
const isDarkAtom = atomDark() | ||
|
||
export function useDark() { | ||
const [isDark, setIsDark] = useAtom(isDarkAtom) | ||
return { | ||
isDark, | ||
toggleDark: setIsDark as () => void, | ||
theme: (isDark ? "dark" : "light") as "dark" | "light", | ||
} | ||
} |
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { AppearanceSwitch } from "@renderer/components/appearance-switch" | ||
|
||
export function Component() { | ||
return ( | ||
<> | ||
<h1 className="mb-4 flex items-center gap-2 text-2xl font-bold"> | ||
<i className="i-mingcute-settings-7-line text-xl" /> | ||
General | ||
</h1> | ||
<AppearanceSwitch /> | ||
</> | ||
) | ||
} |
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