Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / applications / drive / src / app / components / sections / ToolbarButtons / ShareLinkButton.tsx
blob84f516ff19536172a7aba7bc9edbcc495e68d6cf
1 import { c } from 'ttag';
3 import { Icon, ToolbarButton } from '@proton/components';
5 import type { DecryptedLink } from '../../../store';
6 import { useLinkSharingModal } from '../../modals/ShareLinkModal/ShareLinkModal';
7 import { isMultiSelect, noSelection } from './utils';
9 interface Props {
10     selectedLinks: DecryptedLink[];
13 const ShareLinkButton = ({ selectedLinks }: Props) => {
14     const [linkSharingModal, showLinkSharingModal] = useLinkSharingModal();
16     if (noSelection(selectedLinks) || isMultiSelect(selectedLinks)) {
17         return null;
18     }
20     return (
21         <>
22             <ToolbarButton
23                 disabled={noSelection(selectedLinks) || isMultiSelect(selectedLinks)}
24                 title={c('Action').t`Share`}
25                 icon={<Icon name="user-plus" alt={c('Action').t`Share`} />}
26                 onClick={() =>
27                     showLinkSharingModal({ shareId: selectedLinks[0].rootShareId, linkId: selectedLinks[0].linkId })
28                 }
29                 data-testid="toolbar-share-link"
30             />
31             {linkSharingModal}
32         </>
33     );
36 export default ShareLinkButton;