erp-platform/ui/src/components/template/HorizontalMenuContent/HorizontalMenuNavLink.tsx

33 lines
747 B
TypeScript
Raw Normal View History

2025-05-06 06:45:49 +00:00
import { Link } from 'react-router-dom'
import classNames from 'classnames'
import type { PropsWithChildren } from 'react'
2025-06-25 20:46:08 +00:00
import HorizontalMenuIcon from './HorizontalMenuIcon'
2025-05-06 06:45:49 +00:00
export type HorizontalMenuNavLinkProps = PropsWithChildren<{
2025-06-25 20:46:08 +00:00
path: string
isExternalLink?: boolean
className?: string
icon?: string
2025-05-06 06:45:49 +00:00
}>
const HorizontalMenuNavLink = ({
2025-06-25 20:46:08 +00:00
path,
children,
isExternalLink,
className,
icon,
2025-05-06 06:45:49 +00:00
}: HorizontalMenuNavLinkProps) => {
2025-06-25 20:46:08 +00:00
return (
<Link
2025-09-14 21:00:26 +00:00
className={classNames('flex items-center justify-start', className)}
to={path}
target={isExternalLink ? '_blank' : ''}
>
<HorizontalMenuIcon icon={icon || ''} />
<span>{children}</span>
</Link>
2025-06-25 20:46:08 +00:00
)
2025-05-06 06:45:49 +00:00
}
export default HorizontalMenuNavLink