2023-10-29 22:25:16 +08:00
|
|
|
"use client";
|
2023-10-27 17:29:50 +08:00
|
|
|
import React from "react";
|
|
|
|
import Image from "next/image";
|
|
|
|
import circle from "@/app/assets/circle.png";
|
|
|
|
import styles from "./LeftNav.module.scss";
|
|
|
|
import Link from "next/link";
|
2023-10-29 22:25:16 +08:00
|
|
|
import { usePathname } from "next/navigation";
|
2023-10-27 17:29:50 +08:00
|
|
|
|
2023-10-29 22:25:16 +08:00
|
|
|
const LeftNav = ({
|
|
|
|
navigations,
|
|
|
|
title,
|
|
|
|
}: {
|
|
|
|
navigations: any[];
|
|
|
|
title: string;
|
|
|
|
}) => {
|
|
|
|
const pathname = usePathname();
|
2023-10-27 17:29:50 +08:00
|
|
|
return (
|
2023-10-30 17:29:35 +08:00
|
|
|
<div
|
|
|
|
className={
|
|
|
|
"left-nav min-h-[600px] h-full bg-[#d7ecfd] rounded shadow pt-2"
|
|
|
|
}
|
|
|
|
>
|
2023-10-29 22:25:16 +08:00
|
|
|
<div className={"flex items-center pl-2 h-7"}>
|
2023-10-27 17:29:50 +08:00
|
|
|
<Image src={circle} alt={"circle icon"} height={16} width={16} />
|
2023-10-29 22:25:16 +08:00
|
|
|
<span className={"pl-2"}>{title}</span>
|
2023-10-27 17:29:50 +08:00
|
|
|
</div>
|
2023-10-29 22:25:16 +08:00
|
|
|
{navigations.length > 0 && (
|
|
|
|
<div
|
|
|
|
className={`${styles.navContent} mt-3 mx-3 rounded-lg px-2.5 py-[5px]`}
|
|
|
|
>
|
|
|
|
<ul className={styles.navItems}>
|
|
|
|
{navigations.map((navigation) => (
|
|
|
|
<li key={navigation.href}>
|
|
|
|
<Link
|
|
|
|
className={`text-sm px-[9px] h-[34px] flex items-center font-bold transition-all hover:text-[#fff176] hover:text-xs ${
|
|
|
|
navigation.href === pathname
|
|
|
|
? "text-[#fff176] text-xs"
|
|
|
|
: "text-white"
|
|
|
|
}`}
|
|
|
|
href={navigation.href}
|
|
|
|
>
|
|
|
|
{navigation.title}
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
)}
|
2023-10-27 17:29:50 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default LeftNav;
|