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

35 lines
990 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}`
return (
<button type='button'
2023-11-05 16:31:49 +03:00
className={`text-sm small-caps ${!transparent && 'border'} ${cursor} ${position} text-btn text-controls select-none ${transparent ? 'clr-hover' : colors}`}
2023-10-06 14:39:32 +03:00
title={tooltip}
{...props}
>
{icon && icon}
{text && <div className={'font-semibold whitespace-nowrap pb-1'}>{text}</div>}
</button>
);
}
export default SelectorButton;