first commit

This commit is contained in:
2026-02-28 23:01:30 +08:00
commit 3956ee4806
415 changed files with 74538 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
'use client';
import { useTheme } from './ThemeProvider';
import { useEffect, useState } from 'react';
export function ThemeToggle() {
const { theme, toggleTheme } = useTheme();
const [mounted, setMounted] = useState(false);
// Avoid hydration mismatch by only rendering icon after mount
useEffect(() => {
setMounted(true);
}, []);
if (!mounted) {
return <button className="theme-toggle" style={{ visibility: 'hidden' }}></button>;
}
return (
<button
onClick={toggleTheme}
className="theme-toggle"
title={theme === 'light' ? '切换到深色模式' : '切换到亮色模式'}
aria-label="Toggle theme"
>
{theme === 'light' ? '🌙' : '☀️'}
</button>
);
}