overleaf/services/web/frontend/js/features/group-management/components/managed-users/managed-user-dropdown-button.tsx
Alexandre Bourdin 6bd60cf0ba Merge pull request #14141 from overleaf/mf-fix-managed-users-new-design-system
Fix managed users UI for new design system

GitOrigin-RevId: 299ffcee23d9b066bd892cc1a67985ea305a491d
2023-08-04 08:03:53 +00:00

53 lines
1.6 KiB
TypeScript

import { Dropdown, MenuItem } from 'react-bootstrap'
import { User } from '../../../../../../types/group-management/user'
import ControlledDropdown from '../../../../shared/components/controlled-dropdown'
import { useTranslation } from 'react-i18next'
import MenuItemButton from '../../../project-list/components/dropdown/menu-item-button'
type ManagedUserDropdownButtonProps = {
user: User
openOffboardingModalForUser: (user: User) => void
}
export default function ManagedUserDropdownButton({
user,
openOffboardingModalForUser,
}: ManagedUserDropdownButtonProps) {
const { t } = useTranslation()
const onDeleteUserClick = () => {
openOffboardingModalForUser(user)
}
return (
<span className="managed-user-actions">
<ControlledDropdown id={`managed-user-dropdown-${user._id}`}>
<Dropdown.Toggle
bsStyle={null}
className="btn btn-link action-btn"
noCaret
>
<i
className="fa fa-ellipsis-v"
aria-hidden="true"
aria-label={t('actions')}
/>
</Dropdown.Toggle>
<Dropdown.Menu className="dropdown-menu-right">
{user.enrollment ? (
<MenuItemButton
className="delete-user-action"
onClick={onDeleteUserClick}
>
{t('delete_user')}
</MenuItemButton>
) : (
<MenuItem className="no-actions-available">
<span className="text-muted">{t('no_actions')}</span>
</MenuItem>
)}
</Dropdown.Menu>
</ControlledDropdown>
</span>
)
}