34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
// app/components/PageLinks/PageLinks.tsx
|
|
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { ISidebarLink } from "@/app/features/dashboard/sidebar/SidebarLink.interfaces"; // Keep this import
|
|
import clsx from "clsx"; // Utility to merge class names
|
|
import "./PageLinks.scss"; // Keep this import
|
|
|
|
// Define the props interface for your PageLinks component
|
|
// It now extends ISidebarLink and includes isShowIcon
|
|
interface IPageLinksProps extends ISidebarLink {
|
|
isShowIcon?: boolean;
|
|
}
|
|
|
|
// PageLinks component
|
|
export default function PageLinks({
|
|
title,
|
|
path,
|
|
icon: Icon, // Destructure icon as Icon
|
|
}: // isShowIcon, // If you plan to use this prop, uncomment it and add logic
|
|
IPageLinksProps) {
|
|
return (
|
|
// Corrected Link usage for Next.js 13/14 App Router:
|
|
// - Removed `passHref` and `legacyBehavior`
|
|
// - Applied `className` directly to the Link component
|
|
// - Removed the nested `<a>` tag
|
|
<Link href={path} className={clsx("page-link", "page-link__container")}>
|
|
{/* Conditionally render Icon if it exists */}
|
|
{Icon && <Icon />}
|
|
<span className="page-link__text">{title}</span>
|
|
</Link>
|
|
);
|
|
}
|