Add theme toggle with light, dark, and system support

- **Header:** Integrate `ThemeToggle` component into the user menu area.
- **Theme Provider:** Introduce `ThemeProvider` context for managing and persisting theme preferences.
- **New Components:** Add `ThemeToggle` for switching themes and `ThemeProvider` to handle state and system preferences.
- Ensure responsive updates and localStorage persistence for user-selected themes.
This commit is contained in:
2025-11-02 06:53:46 +01:00
parent 30f0ec5a64
commit af260e4748
4 changed files with 144 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ import { Button } from '@/components/ui/button';
import { Avatar, AvatarFallback } from '@/components/ui/avatar';
import { Settings, LogOut, User, Shield } from 'lucide-react';
import { cn } from '@/lib/utils';
import { ThemeToggle } from '@/components/theme';
/**
* Get user initials for avatar
@@ -97,8 +98,9 @@ export function Header() {
</nav>
</div>
{/* Right side - User menu */}
<div className="ml-auto flex items-center space-x-4">
{/* Right side - Theme toggle and user menu */}
<div className="ml-auto flex items-center space-x-2">
<ThemeToggle />
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="relative h-10 w-10 rounded-full">