import React from 'react'; import { Icon, Tooltip } from 'UI'; import cn from 'classnames'; import stl from './sideMenuItem.module.css'; import { IconNames } from 'UI/SVG'; type Props = { title: string; iconName?: IconNames; iconBg?: boolean; iconColor?: string; iconSize?: number; className?: string; active?: boolean; disabled?: boolean; tooltipTitle?: string; onClick?: () => void; deleteHandler?: () => void; leading?: React.ReactNode; id?: string; }; function SideMenuItem({ iconBg = false, iconColor = 'gray-dark', iconSize = 18, className = '', iconName, title, active = false, disabled = false, tooltipTitle = '', onClick, deleteHandler, leading = null, ...props }: Props) { const handleClick = () => { if (disabled) return; if (onClick) onClick(); }; const handleDeleteClick = (e: React.MouseEvent) => { e.stopPropagation(); if (deleteHandler) deleteHandler(); }; return (
{iconName && (
{iconBg &&
}
)} {title}
{leading && leading} {deleteHandler && (
)}
); } export default SideMenuItem;