import type { FC } from "react";
import { useBarItems } from "../tabs";
import { Link } from "react-router";

const Sidebar: FC = () => {
  const [barItems, isActive] = useBarItems();

  return (
    <div className="hidden sm:flex flex-col gap-2 items-stretch min-w-80 w-80 p-5 pt-18 min-h-screen select-none bg-white/65 dark:bg-black/65 shadow-lg shadow-gray-300 dark:shadow-gray-700">
      {barItems.map((item) => (
        <Link to={item.pathname} key={item.tab}>
          <div
            className={`dark:text-gray-200 transition-colors text-sm cursor-pointer p-4 rounded-lg flex flex-row items-center gap-3${
              isActive(item) ? " bg-gray-200 dark:bg-gray-900" : ""
            }`}
          >
            {item.icon} {item.title}
          </div>
        </Link>
      ))}
    </div>
  );
};

export default Sidebar;
