"use client"; import { useTheme } from "next-themes"; import { useEffect, useState } from "react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { Moon, Sun } from "lucide-react"; import { cn } from "@/lib/utils"; const THEMES = [ { value: "light", label: "Clair", icon: Sun, description: "Thème clair", }, { value: "dark", label: "Sombre", icon: Moon, description: "Thème sombre", }, ] as const; export function ThemeCard() { const { theme, setTheme } = useTheme(); const [mounted, setMounted] = useState(false); // Éviter le flash de contenu non stylé useEffect(() => { setMounted(true); }, []); if (!mounted) { return null; } const currentTheme = theme || "light"; return ( Thème Choisissez le thème d'affichage de l'application setTheme(value)} >
{THEMES.map((themeOption) => { const Icon = themeOption.icon; return ( ); })}
); }