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 SelectorButtonProps extends CProps.Button {
|
|
|
|
text?: string;
|
|
|
|
icon?: React.ReactNode;
|
2023-12-18 19:42:27 +03:00
|
|
|
|
2023-12-28 14:04:44 +03:00
|
|
|
colors?: string;
|
|
|
|
transparent?: boolean;
|
2023-10-06 14:39:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function SelectorButton({
|
2023-12-28 14:04:44 +03:00
|
|
|
text,
|
|
|
|
icon,
|
|
|
|
title,
|
2023-11-05 16:31:49 +03:00
|
|
|
colors = 'clr-btn-default',
|
2023-12-18 19:42:27 +03:00
|
|
|
className,
|
2023-10-06 14:39:32 +03:00
|
|
|
transparent,
|
2023-11-27 13:50:56 +03:00
|
|
|
...restProps
|
2023-10-06 14:39:32 +03:00
|
|
|
}: SelectorButtonProps) {
|
|
|
|
return (
|
2023-12-28 14:04:44 +03:00
|
|
|
<button
|
|
|
|
type='button'
|
|
|
|
data-tooltip-id={title ? globalIDs.tooltip : undefined}
|
|
|
|
data-tooltip-content={title}
|
|
|
|
className={clsx(
|
|
|
|
'px-1 flex flex-start items-center gap-1',
|
2023-12-30 19:43:24 +03:00
|
|
|
'text-sm font-controls select-none',
|
2023-12-28 14:04:44 +03:00
|
|
|
'text-btn clr-text-controls',
|
|
|
|
'disabled:cursor-not-allowed cursor-pointer',
|
|
|
|
{
|
|
|
|
'clr-hover': transparent,
|
|
|
|
'border': !transparent
|
|
|
|
},
|
|
|
|
className,
|
|
|
|
!transparent && colors
|
|
|
|
)}
|
|
|
|
{...restProps}
|
|
|
|
>
|
|
|
|
{icon ? icon : null}
|
2023-12-30 19:43:24 +03:00
|
|
|
{text ? <div className={'whitespace-nowrap pb-1'}>{text}</div> : null}
|
2023-12-28 14:04:44 +03:00
|
|
|
</button>
|
|
|
|
);
|
2023-10-06 14:39:32 +03:00
|
|
|
}
|
|
|
|
|
2023-12-28 14:04:44 +03:00
|
|
|
export default SelectorButton;
|