import classNames from 'classnames'; import React from 'react'; import { NavLink } from 'react-router-dom'; import { Icon, Text, Counter } from './ui'; interface ISidebarNavigationLink { count?: number, icon: string, text: string | React.ReactElement, to?: string, onClick?: React.EventHandler, } const SidebarNavigationLink = React.forwardRef((props: ISidebarNavigationLink, ref: React.ForwardedRef): JSX.Element => { const { icon, text, to = '', count, onClick } = props; const isActive = location.pathname === to; const withCounter = typeof count !== 'undefined'; const handleClick: React.EventHandler = (e) => { if (onClick) { onClick(e); e.preventDefault(); e.stopPropagation(); } }; return ( {withCounter && count > 0 ? ( ) : null} {text} ); }); export default SidebarNavigationLink;