2023-12-15 17:34:50 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2023-10-06 14:39:32 +03:00
|
|
|
interface SelectorButtonProps
|
|
|
|
extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'children' | 'title' | 'type'> {
|
|
|
|
text?: string
|
|
|
|
icon?: React.ReactNode
|
|
|
|
tooltip?: string
|
|
|
|
dimensions?: string
|
|
|
|
borderClass?: string
|
2023-11-05 16:31:49 +03:00
|
|
|
colors?: string
|
2023-10-06 14:39:32 +03:00
|
|
|
transparent?: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
function SelectorButton({
|
|
|
|
text, icon, tooltip,
|
2023-11-05 16:31:49 +03:00
|
|
|
colors = 'clr-btn-default',
|
2023-10-06 14:39:32 +03:00
|
|
|
dimensions = 'w-fit h-fit',
|
|
|
|
transparent,
|
2023-11-27 13:50:56 +03:00
|
|
|
...restProps
|
2023-10-06 14:39:32 +03:00
|
|
|
}: SelectorButtonProps) {
|
|
|
|
return (
|
2023-12-05 01:22:44 +03:00
|
|
|
<button type='button'
|
2023-12-15 17:34:50 +03:00
|
|
|
className={clsx(
|
|
|
|
'px-1 flex flex-start items-center gap-1',
|
|
|
|
'text-sm small-caps select-none',
|
|
|
|
'text-btn clr-text-controls',
|
|
|
|
'disabled:cursor-not-allowed cursor-pointer',
|
|
|
|
{
|
|
|
|
'clr-hover': transparent,
|
|
|
|
'border': !transparent,
|
|
|
|
},
|
|
|
|
!transparent && colors,
|
|
|
|
dimensions
|
|
|
|
)}
|
2023-12-05 01:22:44 +03:00
|
|
|
title={tooltip}
|
|
|
|
{...restProps}
|
|
|
|
>
|
|
|
|
{icon ? icon : null}
|
|
|
|
{text ? <div className={'font-semibold whitespace-nowrap pb-1'}>{text}</div> : null}
|
|
|
|
</button>);
|
2023-10-06 14:39:32 +03:00
|
|
|
}
|
|
|
|
|
2023-12-13 14:32:57 +03:00
|
|
|
export default SelectorButton;
|