|
@@ -14,8 +14,9 @@ const ThemeToggle = () => {
|
|
|
|
|
|
|
|
if (!mounted) {
|
|
if (!mounted) {
|
|
|
return (
|
|
return (
|
|
|
- <Button variant="ghost" size="sm" disabled>
|
|
|
|
|
|
|
+ <Button variant="ghost" size="sm" disabled className="gap-2">
|
|
|
<Sun className="h-4 w-4" />
|
|
<Sun className="h-4 w-4" />
|
|
|
|
|
+ <span className="text-xs">Clair</span>
|
|
|
</Button>
|
|
</Button>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
@@ -24,18 +25,35 @@ const ThemeToggle = () => {
|
|
|
setTheme(theme === 'dark' ? 'light' : 'dark');
|
|
setTheme(theme === 'dark' ? 'light' : 'dark');
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ const isDark = theme === 'dark';
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<Button
|
|
<Button
|
|
|
variant="ghost"
|
|
variant="ghost"
|
|
|
size="sm"
|
|
size="sm"
|
|
|
onClick={toggleTheme}
|
|
onClick={toggleTheme}
|
|
|
- aria-label={theme === 'dark' ? 'Activer le mode clair' : 'Activer le mode sombre'}
|
|
|
|
|
|
|
+ aria-label={isDark ? 'Activer le mode clair' : 'Activer le mode sombre'}
|
|
|
|
|
+ className="gap-2 transition-all duration-300"
|
|
|
>
|
|
>
|
|
|
- {theme === 'dark' ? (
|
|
|
|
|
- <Sun className="h-4 w-4" />
|
|
|
|
|
- ) : (
|
|
|
|
|
- <Moon className="h-4 w-4" />
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ <div className="relative w-4 h-4">
|
|
|
|
|
+ <Sun
|
|
|
|
|
+ className={`h-4 w-4 absolute inset-0 transition-all duration-300 ${
|
|
|
|
|
+ isDark
|
|
|
|
|
+ ? 'rotate-0 scale-100 opacity-100 text-yellow-400'
|
|
|
|
|
+ : 'rotate-90 scale-0 opacity-0'
|
|
|
|
|
+ }`}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Moon
|
|
|
|
|
+ className={`h-4 w-4 absolute inset-0 transition-all duration-300 ${
|
|
|
|
|
+ isDark
|
|
|
|
|
+ ? '-rotate-90 scale-0 opacity-0'
|
|
|
|
|
+ : 'rotate-0 scale-100 opacity-100 text-slate-600 dark:text-slate-400'
|
|
|
|
|
+ }`}
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <span className="text-xs font-medium hidden sm:inline">
|
|
|
|
|
+ {isDark ? 'Sombre' : 'Clair'}
|
|
|
|
|
+ </span>
|
|
|
</Button>
|
|
</Button>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|