feat: add isLoading prop

This commit is contained in:
ValdiANS
2025-12-18 16:07:19 +07:00
parent 09d36f504b
commit 3a35c72e06
+15 -2
View File
@@ -8,6 +8,7 @@ interface MenuItemProps {
href?: string;
icon?: string;
active?: boolean;
isLoading?: boolean;
onClick?: () => void;
className?: string;
}
@@ -17,6 +18,7 @@ const MenuItem = ({
href,
icon,
active = false,
isLoading = false,
className,
onClick,
}: MenuItemProps) => {
@@ -50,17 +52,28 @@ const MenuItem = ({
return (
<li>
{href && (
{!isLoading && href && (
<Link href={href} className={menuItemBaseClassName}>
{menuItemContent}
</Link>
)}
{!href && (
{!isLoading && !href && (
<button className={menuItemBaseClassName} onClick={onClick}>
{menuItemContent}
</button>
)}
{isLoading && (
<button className={menuItemBaseClassName}>
<span
className={cn('loading loading-dots loading-md mx-auto', {
'text-gray-400': !active,
'text-black': active,
})}
/>
</button>
)}
</li>
);
};