Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / applications / drive / src / app / components / sections / ContextMenu / buttons / CopyLinkButton.tsx
blob7f3f468b7140b9e75881accd71e7f164344085a9
1 import { c } from 'ttag';
3 import { useActions } from '../../../../store';
4 import ContextMenuButton from '../ContextMenuButton';
6 interface Props {
7     shareId: string;
8     linkId: string;
9     close: () => void;
12 const CopyLinkButton = ({ shareId, linkId, close }: Props) => {
13     const { copyShareLinkToClipboard } = useActions(); // We can use it here since we don't need confirmModal
15     if (!copyShareLinkToClipboard) {
16         return null;
17     }
19     return (
20         <ContextMenuButton
21             name={c('Action').t`Copy link`}
22             icon="link"
23             testId="context-menu-copy-link"
24             action={() => copyShareLinkToClipboard(new AbortController().signal, shareId, linkId)}
25             close={close}
26         />
27     );
30 export default CopyLinkButton;