ConceptPortal-public/rsconcept/frontend/src/components/Common/SelectorButton.tsx

36 lines
1019 B
TypeScript
Raw Normal View History

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';
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'
className={`text-sm small-caps select-none ${cursor} ${position} ${design}`}
2023-10-06 14:39:32 +03:00
title={tooltip}
{...props}
>
{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;