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

24 lines
660 B
TypeScript
Raw Normal View History

2023-09-02 01:11:27 +03:00
interface DropdownButtonProps {
tooltip?: string | undefined
2023-07-21 00:09:05 +03:00
onClick?: () => void
disabled?: boolean
children: React.ReactNode
}
2023-09-02 01:11:27 +03:00
function DropdownButton({ tooltip, onClick, disabled, children }: DropdownButtonProps) {
const behavior = onClick ? 'cursor-pointer disabled:cursor-not-allowed clr-hover' : 'cursor-default';
2023-11-10 15:34:59 +03:00
const text = disabled ? 'text-controls' : '';
2023-07-21 00:09:05 +03:00
return (
<button type='button'
2023-07-21 00:09:05 +03:00
disabled={disabled}
2023-09-02 01:11:27 +03:00
title={tooltip}
2023-07-21 00:09:05 +03:00
onClick={onClick}
2023-11-10 15:34:59 +03:00
className={`px-3 py-1 text-left overflow-ellipsis whitespace-nowrap ${behavior} ${text}`}
2023-07-21 00:09:05 +03:00
>
{children}
</button>
);
}
2023-07-25 20:27:29 +03:00
export default DropdownButton;