This commit is contained in:
ValdiANS
2025-09-26 11:06:31 +07:00
parent a5524686a6
commit 2e1b0fef2b
36 changed files with 8716 additions and 79 deletions
+64
View File
@@ -0,0 +1,64 @@
import Link from 'next/link';
import { Icon } from '@iconify/react';
import { cn } from '@/lib/helper';
interface MenuItemProps {
title: string;
href?: string;
icon?: string;
active?: boolean;
onClick?: () => void;
className?: string;
}
const MenuItem = ({
title,
href,
icon,
active = false,
className,
onClick,
}: MenuItemProps) => {
const menuItemBaseClassName = cn(
'group px-3 py-2 text-base text-black font-semibold flex flex-row items-center rounded-md',
{ 'bg-gray-100 border-l-2 border-l-primary': active },
className
);
const menuItemContent = (
<>
{icon && (
<Icon
icon={icon}
width={20}
height={20}
className={cn({
'text-gray-400': !active,
'text-black': active,
})}
/>
)}
<span
className={cn({ 'opacity-40': !active }, 'group-active:opacity-100')}
>
{title}
</span>
</>
);
return (
<li onClick={onClick}>
{href && (
<Link href={href} className={menuItemBaseClassName}>
{menuItemContent}
</Link>
)}
{!href && <a className={menuItemBaseClassName}>{menuItemContent}</a>}
</li>
);
};
export default MenuItem;