import React from "react";
import Logo from "../../assets/icons/logo.svg";
import Button from "../shared/Button";
import { lowerMenuItems } from "../../utils/data";

const Header = () => {
  return (
    <div className="relative my-2 items-center justify-center flex">
      <div className="container px-8 flex justify-between">
        <img src={Logo} alt="" />

        {/* Right Part of the navbar */}
        <div className="flex flex-col justify-between items-end">
          <ul className={`flex gap-4 items-center`}>
            <li>
              <a href="#">
                <Button className="btn-active" text="Open An Account" />
              </a>
            </li>
            <li>
              <a href="#">
                <Button text="Internet Banking" />
              </a>
            </li>
            <li>
              <a href="#">
                <Button text="Contact Us" />
              </a>
            </li>
            <li>
              <SearchInput />
            </li>
          </ul>
          <ul className="flex gap-4 items-center">
            {lowerMenuItems.map((item) => (
              <li
                key={item.id}
                className="cursor-pointer text-[13.5px] font-medium text-[#525252] tracking-[1px] leading-[-0.3pt]"
              >
                {item.name}
              </li>
            ))}
          </ul>
        </div>
      </div>
    </div>
  );
};

export default Header;

const SearchInput = ({ value, onChange }) => {
  return (
    <div className="flex items-center border border-[#5A2C82] overflow-hidden">
      <input
        type="text"
        value={value}
        onChange={onChange}
        className="py-[6px] px-[12px] w-full outline-none text-[#333] text-sm"
        placeholder="Search..."
      />
      <button
        type="button"
        className="flex items-center justify-center bg-transparent text-[#5A2C82] p-2"
      >
        <svg
          xmlns="http://www.w3.org/2000/svg"
          fill="none"
          viewBox="0 0 24 24"
          strokeWidth={1.5}
          stroke="currentColor"
          className="w-6 h-6"
        >
          <path
            strokeLinecap="round"
            strokeLinejoin="round"
            d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"
          />
        </svg>
      </button>
    </div>
  );
};
