2023-12-15 17:34:50 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
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) {
|
2023-07-21 00:09:05 +03:00
|
|
|
return (
|
2023-12-05 01:22:44 +03:00
|
|
|
<button type='button'
|
|
|
|
disabled={disabled}
|
|
|
|
title={tooltip}
|
|
|
|
onClick={onClick}
|
2023-12-15 17:34:50 +03:00
|
|
|
className={clsx(
|
|
|
|
'px-3 py-1',
|
|
|
|
'text-left overflow-ellipsis whitespace-nowrap',
|
|
|
|
'disabled:clr-text-controls',
|
|
|
|
{
|
|
|
|
'clr-hover': onClick,
|
|
|
|
'cursor-pointer disabled:cursor-not-allowed': onClick,
|
|
|
|
'cursor-default': !onClick
|
|
|
|
}
|
|
|
|
)}
|
2023-12-05 01:22:44 +03:00
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</button>);
|
2023-07-21 00:09:05 +03:00
|
|
|
}
|
|
|
|
|
2023-12-15 17:34:50 +03:00
|
|
|
export default DropdownButton;
|