File size: 1,638 Bytes
75fefa7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"use client";

import Button from "@/components/ui/shadcn/button";
import { useHeaderContext } from "@/components/shared/header/HeaderContext";
import { cn } from "@/utils/cn";

export default function HeaderToggle({
  dropdownContent,
}: {
  dropdownContent: React.ReactNode;
}) {
  const {
    dropdownContent: headerDropdownContent,
    clearDropdown,
    setDropdownContent,
  } = useHeaderContext();

  return (
    <Button
      className="lg:hidden"
      variant="tertiary"
      onClick={() => {
        if (dropdownContent === headerDropdownContent) {
          clearDropdown(true);
        } else {
          setDropdownContent(dropdownContent);
        }
      }}
    >
      <svg
        className="!size-20"
        fill="none"
        height="20"
        viewBox="0 0 20 20"
        width="20"
        xmlns="http://www.w3.org/2000/svg"
      >
        <path
          className={cn("transition-all origin-center", {
            "rotate-45 -translate-y-4": headerDropdownContent,
          })}
          d="M2.28906 13.9609H17.7057"
          stroke="#262626"
          strokeLinecap="round"
          strokeLinejoin="round"
          strokeWidth="1.25"
          style={{
            transformBox: "fill-box",
          }}
        />
        <path
          className={cn("transition-all origin-center", {
            "-rotate-45 translate-y-3 translate-x-[2.5px]":
              headerDropdownContent,
          })}
          d="M2.28906 6.03906H17.7057"
          stroke="#262626"
          strokeLinecap="round"
          strokeLinejoin="round"
          strokeWidth="1.25"
        />
      </svg>
    </Button>
  );
}