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

23 lines
622 B
TypeScript
Raw Normal View History

2023-07-21 00:09:05 +03:00
interface NavigationTextItemProps {
description?: string | undefined
onClick?: () => void
disabled?: boolean
children: React.ReactNode
}
2023-07-25 20:27:29 +03:00
function DropdownButton({ description = '', onClick, disabled, children }: NavigationTextItemProps) {
const behavior = (onClick ? 'cursor-pointer clr-hover' : 'cursor-default') + ' disabled:cursor-not-allowed';
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}
title={description}
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;