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,
|
|
|
|
...props
|
|
|
|
}: SelectorButtonProps) {
|
|
|
|
const cursor = 'disabled:cursor-not-allowed cursor-pointer';
|
2023-11-27 11:33:34 +03:00
|
|
|
const position = `px-1 flex flex-start items-center gap-1 ${dimensions}`;
|
|
|
|
const design = (transparent ? 'clr-hover' : `border ${colors}`) + ' text-btn text-controls';
|
2023-10-06 14:39:32 +03:00
|
|
|
return (
|
|
|
|
<button type='button'
|
2023-11-27 11:33:34 +03:00
|
|
|
className={`text-sm small-caps select-none ${cursor} ${position} ${design}`}
|
2023-10-06 14:39:32 +03:00
|
|
|
title={tooltip}
|
|
|
|
{...props}
|
|
|
|
>
|
2023-11-27 11:33:34 +03:00
|
|
|
{icon ? icon : null}
|
|
|
|
{text ? <div className={'font-semibold whitespace-nowrap pb-1'}>{text}</div> : null}
|
2023-10-06 14:39:32 +03:00
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SelectorButton;
|