-
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.
- Loading branch information
1 parent
6bde0e4
commit b022da8
Showing
10 changed files
with
1,117 additions
and
25 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** @type {import('postcss-load-config').Config} */ | ||
const config = { | ||
plugins: { | ||
tailwindcss: {}, | ||
}, | ||
}; | ||
|
||
export default config; |
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,42 @@ | ||
"use client"; | ||
import { useState, useEffect } from "react"; | ||
import { useTheme } from "next-themes"; | ||
|
||
const MoonIcon = () => ( | ||
<svg viewBox="0 0 1024 1024" className="w-5 h-5"> | ||
<path | ||
d="M608.256 201.728c12.8 5.632 24.576 11.776 36.352 18.432-11.776-7.168-23.552-13.312-36.352-18.432z m72.704 43.008c10.24 7.68 19.968 16.384 29.184 25.088-9.216-9.216-18.944-17.408-29.184-25.088z m120.832 352.768c-4.096 16.384-9.728 32.256-16.384 47.616 6.656-15.36 12.288-31.232 16.384-47.616z m-440.32-160.768c0-120.832 81.408-222.208 193.024-252.928-5.632-1.536-11.776-2.56-17.408-3.584-1.536-0.512-3.584-0.512-5.12-1.024l-10.752-1.536c-3.072-0.512-6.144-1.024-9.216-1.024-2.048 0-3.584-0.512-5.632-0.512-4.608-0.512-9.216-1.024-13.824-1.024h-3.584c-5.12 0-10.24-0.512-15.36-0.512-186.88 0-338.432 151.04-338.432 337.92 0 186.368 151.552 337.92 338.432 337.92 5.12 0 10.24 0 15.872-0.512 1.536 0 3.072 0 4.608-0.512 4.096 0 7.68-0.512 11.264-1.024 1.536 0 3.072-0.512 4.608-0.512 5.12-0.512 10.24-1.024 15.36-2.048h0.512c4.608-0.512 9.728-1.536 14.336-2.56 1.536-0.512 3.072-0.512 4.608-1.024 3.584-1.024 7.168-1.536 10.752-2.56 1.536-0.512 3.072-0.512 4.608-1.024 4.608-1.024 9.728-2.56 14.336-4.096 0.512 0 1.024-0.512 1.536-0.512 4.096-1.536 8.192-2.56 12.288-4.096l4.608-1.536c3.072-1.024 6.656-2.56 9.728-3.584 1.536-0.512 3.072-1.024 4.608-2.048 4.608-2.048 8.704-3.584 13.312-6.144 1.024-0.512 1.536-1.024 2.56-1.024 3.584-1.536 7.168-3.584 10.752-5.632 1.536-1.024 3.072-1.536 4.608-2.56 3.072-1.536 5.632-3.072 8.192-4.608 1.536-1.024 3.072-1.536 4.608-2.56 4.096-2.56 7.68-5.12 11.776-7.68 1.024-0.512 2.048-1.536 3.072-2.048 3.072-2.048 5.632-4.096 8.704-6.144 1.536-1.024 3.072-2.56 4.608-3.584 2.56-2.048 4.608-3.584 7.168-5.632 1.536-1.024 3.072-2.56 4.608-3.584 3.584-3.072 6.656-5.632 10.24-8.704 1.536-1.024 2.56-2.56 4.096-3.584 2.048-2.048 4.608-4.096 6.656-6.144l4.608-4.608c2.048-2.048 3.584-4.096 5.632-6.144 1.536-1.536 3.072-3.072 4.096-4.608 2.56-3.072 5.12-6.144 8.192-9.216 1.536-1.536 3.072-3.584 4.608-5.632 1.536-2.048 3.584-4.096 5.12-6.656 1.536-2.048 2.56-3.584 4.096-5.632l4.608-6.144c1.536-2.048 2.56-3.584 4.096-5.632 2.048-3.072 4.096-6.656 6.144-9.728 1.536-2.048 2.56-4.608 4.096-6.656 1.536-2.048 2.56-4.608 4.096-6.656 1.024-2.048 2.048-4.096 3.584-6.144 1.024-2.048 2.048-4.608 3.584-6.656l3.072-6.144c2.048-4.096 3.584-7.68 5.12-11.776-44.544 34.304-100.352 54.784-160.768 54.784-146.432-0.512-264.704-117.76-264.704-263.168z m276.48-92.16l-88.064 16.384 61.44 64-11.264 87.04 81.408-37.376L762.88 512l-11.264-87.04 61.44-64-88.064-16.384-43.52-76.8-43.52 76.8z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
|
||
const SunIcon = () => ( | ||
<svg viewBox="0 0 1024 1024" className="w-5 h-5"> | ||
<path | ||
d="M876.544 502.784l-100.352-99.84V260.608c0-7.168-5.632-12.8-12.8-12.8h-142.848l-100.352-99.84c-5.12-5.12-13.312-5.12-18.432 0L401.92 247.808H260.608c-7.168 0-12.8 5.632-12.8 12.8v141.312L147.456 502.784c-5.12 5.12-5.12 13.312 0 18.432l100.352 99.84v142.336c0 7.168 5.632 12.8 12.8 12.8h141.312l100.864 100.864c5.12 5.12 13.312 5.12 18.432 0l100.864-100.864h142.336c7.168 0 12.8-5.632 12.8-12.8v-142.336l99.84-99.84c4.608-5.12 4.608-13.312-0.512-18.432zM511.488 742.4c-127.488 0-230.4-102.912-230.4-230.4 0-126.976 103.424-230.4 230.4-230.4 127.488 0 230.4 102.912 230.4 230.4 0 126.976-102.912 230.4-230.4 230.4z m0-414.72c-101.888 0-184.32 82.432-184.32 184.32s82.432 184.32 184.32 184.32 184.32-82.432 184.32-184.32-82.432-184.32-184.32-184.32z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
|
||
function ThemeToggle() { | ||
const [mounted, setMounted] = useState(false); | ||
const { theme, setTheme } = useTheme(); | ||
|
||
useEffect(() => setMounted(true), []); | ||
|
||
if (!mounted) return null; | ||
|
||
return ( | ||
<button | ||
className="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors" | ||
onClick={() => setTheme(theme === "dark" ? "light" : "dark")} | ||
aria-label={theme === "dark" ? "切换到亮色模式" : "切换到暗色模式"} | ||
> | ||
{theme === "dark" ? <SunIcon /> : <MoonIcon />} | ||
</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