File size: 637 Bytes
24d40b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

import { Moon, Sun } from "lucide-react";
import { Button } from "@/components/ui/button";
import { useTheme } from "./ThemeProvider";

export function ThemeToggle() {
  const { theme, setTheme } = useTheme();

  return (
    <Button

      variant="ghost"

      size="icon"

      onClick={() => setTheme(theme === "dark" ? "light" : "dark")}

      className="rounded-full"

    >

      {theme === "dark" ? (

        <Sun className="h-5 w-5 text-yellow-400" />

      ) : (

        <Moon className="h-5 w-5 text-violet-dark" />

      )}

      <span className="sr-only">Changer le thème</span>

    </Button>
  );
}