File size: 1,084 Bytes
db78b1a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
27
28
29
30
31
32
33
34
35
36
37
import { Button } from "@theme";
import cn from "@utils/classnames.ts";
import { useTheme } from "@utils/context/theme/useTheme.ts";
import { MonitorCog, Moon, Sun } from "lucide-react";

function Header({ className = "" }: { className?: string }) {
  const { storedTheme, toggleTheme } = useTheme();

  return (
    <div className={cn(className)}>
      <div className="flex items-center justify-between gap-2 border-b-1 border-gray-200 px-4 py-2 dark:border-gray-800">
        <h1 className="font-bold">Transformers.js TextGeneration</h1>
        <Button
          color="mono"
          variant="ghost"
          onClick={toggleTheme}
          size="sm"
          aria-label="Toggle theme"
          iconRight={
            storedTheme === "system" ? (
              <MonitorCog className="h-3 w-3" />
            ) : storedTheme === "light" ? (
              <Sun className="h-3 w-3" />
            ) : (
              <Moon className="h-3 w-3" />
            )
          }
        >
          Theme:{" "}
        </Button>
      </div>
    </div>
  );
}

export default Header;