Files
myeasycms-v2/apps/web/app/(marketing)/_components/site-navigation-item.tsx
giancarlo e00cb3c591 Refactor logger usage and add discount field to checkout
This commit refactors the logger usage in various files to make it more streamlined and consistent. It also introduces a new 'enableDiscountField' feature for the checkout that can be toggled on specific products. This allows customers to apply discounts at checkout if the product or subscription plan has the 'enableDiscountField' set to true.
2024-04-10 22:24:11 +08:00

33 lines
748 B
TypeScript

'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { NavigationMenuItem } from '@kit/ui/navigation-menu';
import { cn, isRouteActive } from '@kit/ui/utils';
const getClassName = (path: string, currentPathName: string) => {
const isActive = isRouteActive(path, currentPathName);
return cn(`text-sm font-medium`, {
'hover:underline': !isActive,
});
};
export function SiteNavigationItem({
path,
children,
}: React.PropsWithChildren<{
path: string;
}>) {
const currentPathName = usePathname();
return (
<NavigationMenuItem key={path}>
<Link className={getClassName(path, currentPathName)} href={path}>
{children}
</Link>
</NavigationMenuItem>
);
}