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-07-27 22:04:25 +03:00
|
|
|
interface MiniButtonProps
|
2023-12-18 19:42:27 +03:00
|
|
|
extends CProps.Button {
|
2023-09-15 23:29:52 +03:00
|
|
|
icon: React.ReactNode
|
2023-08-22 23:45:59 +03:00
|
|
|
noHover?: boolean
|
2023-07-27 22:04:25 +03:00
|
|
|
}
|
|
|
|
|
2023-09-15 23:29:52 +03:00
|
|
|
function MiniButton({
|
2023-12-18 19:42:27 +03:00
|
|
|
icon, noHover, tabIndex,
|
2023-12-21 00:12:24 +03:00
|
|
|
title, className,
|
2023-11-27 13:50:56 +03:00
|
|
|
...restProps
|
2023-09-15 23:29:52 +03:00
|
|
|
}: MiniButtonProps) {
|
2023-07-27 22:04:25 +03:00
|
|
|
return (
|
2023-12-05 01:22:44 +03:00
|
|
|
<button type='button'
|
|
|
|
tabIndex={tabIndex ?? -1}
|
2023-12-15 17:34:50 +03:00
|
|
|
className={clsx(
|
|
|
|
'px-1 py-1',
|
|
|
|
'rounded-full',
|
|
|
|
'clr-btn-clear',
|
|
|
|
'cursor-pointer disabled:cursor-not-allowed',
|
|
|
|
{
|
|
|
|
'outline-none': noHover,
|
|
|
|
'clr-hover': !noHover
|
|
|
|
},
|
2023-12-18 19:42:27 +03:00
|
|
|
className
|
2023-12-15 17:34:50 +03:00
|
|
|
)}
|
2023-12-21 00:12:24 +03:00
|
|
|
data-tooltip-id={title ? (globalIDs.tooltip) : undefined}
|
|
|
|
data-tooltip-content={title}
|
2023-12-05 01:22:44 +03:00
|
|
|
{...restProps}
|
|
|
|
>
|
|
|
|
{icon}
|
|
|
|
</button>);
|
2023-07-27 22:04:25 +03:00
|
|
|
}
|
|
|
|
|
2023-12-15 17:34:50 +03:00
|
|
|
export default MiniButton;
|