import { FC, ReactNode, MouseEvent } from 'react'
import { Link } from 'react-router-dom'
import { clx } from '../helpers/utils'


type Props = {
    icon: ReactNode,
    title: string,
    isActive: boolean,
    link: string,
    isLogout?: boolean,
    isWithoutLine?: boolean,
    onClick?: (event: MouseEvent<HTMLAnchorElement>) => void
}

const SideBarItem: FC<Props> = (props: Props) => {

    return (
        <Link to={props.link} className='flex text-xs gap-9 mt-4' onClick={props.onClick}>
            {
                !props.isWithoutLine &&
                <div className={clx(
                    'w-1 bg-black h-6',
                    !props.isActive && 'invisible'
                )}></div>
            }
            <div className='flex gap-3 items-center'>
                {props.icon}
                <div className={props.isActive ? 'text-black' : ''}>
                    {props.title}
                </div>
            </div>

        </Link>
    )
}

export default SideBarItem