good stuff
This commit is contained in:
parent
ea8389ef40
commit
f4de0eeb9f
39 changed files with 5165 additions and 348 deletions
|
|
@ -1,7 +1,19 @@
|
|||
import { useState, useRef, useEffect } from 'react';
|
||||
import type { AuthUser } from '../../hooks/useAuth';
|
||||
import { SunIcon } from './icons/SunIcon';
|
||||
import { MoonIcon } from './icons/MoonIcon';
|
||||
|
||||
export default function UserMenu({ user, onLogout }: { user: AuthUser; onLogout: () => void }) {
|
||||
export default function UserMenu({
|
||||
user,
|
||||
theme,
|
||||
onToggleTheme,
|
||||
onLogout,
|
||||
}: {
|
||||
user: AuthUser;
|
||||
theme: 'light' | 'dark';
|
||||
onToggleTheme: () => void;
|
||||
onLogout: () => void;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const menuRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
|
|
@ -48,6 +60,17 @@ export default function UserMenu({ user, onLogout }: { user: AuthUser; onLogout:
|
|||
</div>
|
||||
</div>
|
||||
<div className="p-1">
|
||||
<button
|
||||
onClick={onToggleTheme}
|
||||
className="w-full flex items-center gap-2 px-3 py-2 text-sm text-warm-700 dark:text-warm-300 hover:bg-warm-50 dark:hover:bg-warm-700 rounded"
|
||||
>
|
||||
{theme === 'light' ? (
|
||||
<SunIcon className="w-4 h-4" />
|
||||
) : (
|
||||
<MoonIcon className="w-4 h-4" />
|
||||
)}
|
||||
Theme: {theme === 'light' ? 'Light' : 'Dark'}
|
||||
</button>
|
||||
<a
|
||||
href="/account"
|
||||
onClick={() => setOpen(false)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue