"use client"; import Button from "@/components/Button"; import { CONSOLE_URL, LOGIN_URL } from "@/config/const"; import { Building4, CodeCircle, DocumentText, Element3, Element4, Home2, UserSquare } from "iconsax-react"; import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { FC } from "react"; import { clx } from "../helpers/utils"; import SideBarItem from "./SideBarItem"; import { useSharedStore } from "./store/sharedStore"; const SideBar: FC = () => { const { openSidebar, setOpenSidebar, isLogin } = useSharedStore(); const pathname = usePathname(); const isActive = (name: string) => { if (pathname === "/" && name === "home") { return true; } return pathname.includes(name); }; const iconSizeSideBar = 20; return ( <> {openSidebar &&
setOpenSidebar(false)} />}
logo
منو
} title="صفحه اصلی" isActive={isActive("home")} link={"/"} /> } title={"محصولات"} isActive={isActive("products")} link={"/products"} /> } title={"خدمات دناک"} isActive={isActive("danak-services")} link={"/danak-services"} /> } title={"نمایندگان"} isActive={isActive("representatives")} link={"/representatives"} /> } title={"توسعه دهندگان"} isActive={isActive("developers")} link={"/developers"} /> } title={"درباره ما"} isActive={isActive("about")} link={"/about"} /> } title={"مجله دی مگ"} isActive={isActive("blogs")} link={"/dmag"} /> } title={"تماس با ما"} isActive={isActive("contact")} link={"/contact"} />
{typeof window !== "undefined" && (() => { if (!isLogin) return (
); else return (
); })()}
); }; export default SideBar;