2023-12-15 17:34:50 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2023-12-21 00:12:24 +03:00
|
|
|
import { globalIDs } from '@/utils/constants';
|
|
|
|
|
2023-12-18 19:42:27 +03:00
|
|
|
import { CProps } from '../props';
|
|
|
|
|
2023-12-28 14:04:44 +03:00
|
|
|
interface MiniButtonProps extends CProps.Button {
|
|
|
|
icon: React.ReactNode;
|
|
|
|
noHover?: boolean;
|
2024-02-03 15:33:28 +03:00
|
|
|
hideTitle?: boolean;
|
2023-07-27 22:04:25 +03:00
|
|
|
}
|
|
|
|
|
2024-02-03 15:33:28 +03:00
|
|
|
function MiniButton({ icon, noHover, hideTitle, tabIndex, title, className, ...restProps }: MiniButtonProps) {
|
2023-07-27 22:04:25 +03:00
|
|
|
return (
|
2023-12-28 14:04:44 +03:00
|
|
|
<button
|
|
|
|
type='button'
|
|
|
|
tabIndex={tabIndex ?? -1}
|
|
|
|
className={clsx(
|
|
|
|
'px-1 py-1',
|
|
|
|
'rounded-full',
|
|
|
|
'clr-btn-clear',
|
|
|
|
'cursor-pointer disabled:cursor-not-allowed',
|
|
|
|
{
|
|
|
|
'outline-none': noHover,
|
|
|
|
'clr-hover': !noHover
|
|
|
|
},
|
|
|
|
className
|
|
|
|
)}
|
|
|
|
data-tooltip-id={title ? globalIDs.tooltip : undefined}
|
|
|
|
data-tooltip-content={title}
|
2024-02-03 15:33:28 +03:00
|
|
|
data-tooltip-hidden={hideTitle}
|
2023-12-28 14:04:44 +03:00
|
|
|
{...restProps}
|
|
|
|
>
|
|
|
|
{icon}
|
|
|
|
</button>
|
|
|
|
);
|
2023-07-27 22:04:25 +03:00
|
|
|
}
|
|
|
|
|
2023-12-28 14:04:44 +03:00
|
|
|
export default MiniButton;
|