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-07-21 00:09:05 +03:00
|
|
|
return (
|
2023-07-25 20:27:29 +03:00
|
|
|
<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}
|
|
|
|
className={`px-3 py-1 text-left overflow-ellipsis ${behavior} whitespace-nowrap`}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-07-25 20:27:29 +03:00
|
|
|
export default DropdownButton;
|