import React from "react";
import SidebarItem from "./SidebarItem.jsx";
import Button from "../component/Button.jsx";
import { useNavigate } from "react-router";
import logo from "../../resources/files/images/logo.png";

export default function Sidebar({items}) {
  const [menuToggle, setMenuToggle] = React.useState(false);
  const navigate = useNavigate();

  return (
    <nav
      className={"nav"}
      onClick={() => (menuToggle ? setMenuToggle(false) : setMenuToggle(true))}
    >
      <h1 className="logo"><img src={logo} alt="" /></h1>
      <div className="flex-align-column" style={{ marginTop: `3rem` }}>
        <ul>
          {items.map((item, index) => (
            <SidebarItem key={index} item={item} />
          ))}
        </ul>
      </div>
      <div className="bottom-section flex-center">
          <div className="info-id" ><span onClick={() => {
            navigate("/Join");
          }}>계정추가</span></div>
          <div className="logout"><span>로그아웃</span></div>
        </div>
    </nav>
  );
}
