Files
myeasycms-v2/apps/web/app/(marketing)/_components/site-navigation-item.tsx
giancarlo e7f2660032 Update UI design across multiple pages and components
Several changes have been made to improve the user interface and enhance the user experience. This includes redesigning Auth buttons, modifying website layouts and routing, tweaking heading and text sizes for clarity, and revamping the marketing, documentation, and pricing pages. These changes collectively contribute to a cleaner, more concise and navigable interface.
2024-04-09 13:35:12 +08:00

33 lines
761 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 text-primary`, {
'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>
);
}