import clsx from 'clsx'; import React from 'react'; import { NavLink } from 'react-router-dom'; import { Icon, Text } from './ui'; interface ISidebarNavigationLink { /** Notification count, if any. */ count?: number /** Optional max to cap count (ie: N+) */ countMax?: number /** URL to an SVG icon. */ icon: string /** Link label. */ text: React.ReactNode /** Route to an internal page. */ to?: string /** Callback when the link is clicked. */ onClick?: React.EventHandler } /** Desktop sidebar navigation link. */ const SidebarNavigationLink = React.forwardRef((props: ISidebarNavigationLink, ref: React.ForwardedRef): JSX.Element => { const { icon, text, to = '', count, countMax, onClick } = props; const isActive = location.pathname === to; const handleClick: React.EventHandler = (e) => { if (onClick) { onClick(e); e.preventDefault(); e.stopPropagation(); } }; return ( {text} ); }); export default SidebarNavigationLink;