Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / applications / drive / src / app / components / sections / FileBrowser / ShareIcon.tsx
blob21dceee8c5a9bca4144f8921dc1a8a3c52588c93
1 import { c } from 'ttag';
3 import { Button } from '@proton/atoms';
4 import { Icon, Tooltip } from '@proton/components';
6 import type { BrowserItemId } from '../../FileBrowser/interface';
7 import type { useLinkSharingModal } from '../../modals/ShareLinkModal/ShareLinkModal';
9 interface Props {
10     shareId: string;
11     linkId: BrowserItemId;
12     trashed: number | null;
13     className?: string;
14     showLinkSharingModal: ReturnType<typeof useLinkSharingModal>[1];
15     isAdmin: boolean;
18 const ShareIcon = ({ shareId, linkId, trashed, className, showLinkSharingModal, isAdmin }: Props) => {
19     if (trashed || !isAdmin) {
20         return null;
21     }
23     return (
24         <>
25             <Tooltip title={c('Action').t`Manage share`}>
26                 <Button
27                     icon
28                     shape="ghost"
29                     size="small"
30                     className={className}
31                     onClick={() => {
32                         void showLinkSharingModal({
33                             shareId,
34                             linkId,
35                         });
36                     }}
37                 >
38                     <Icon name="users" alt={c('Action').t`Manage share`} />
39                 </Button>
40             </Tooltip>
41         </>
42     );
45 export default ShareIcon;