Merge branch 'pass-lifetime-fixes' into 'main'
[ProtonMail-WebClient.git] / packages / components / containers / contacts / merge / table / MergeTableBody.tsx
blob84be97408c8636a0b3a7ccf2b4bf6d7942a9d4f6
1 import type { ComponentProps } from 'react';
3 import OrderableTableBody from '@proton/components/components/orderableTable/OrderableTableBody';
4 import type { ContactFormatted } from '@proton/shared/lib/interfaces/contacts';
5 import type { VCardContact } from '@proton/shared/lib/interfaces/contacts/VCard';
7 import MergeTableBodyRow from './MergeTableBodyRow';
9 interface Props extends Omit<ComponentProps<typeof OrderableTableBody>, 'colSpan'> {
10     contacts: ContactFormatted[];
11     vcardContacts?: VCardContact[];
12     highlightedID: string;
13     isChecked: { [ID: string]: boolean };
14     beDeleted: { [ID: string]: boolean };
15     onClickCheckbox: (ID: string) => void;
16     onClickDetails: (ID: string) => void;
17     onToggleDelete: (ID: string) => void;
20 const MergeTableBody = ({
21     contacts,
22     highlightedID,
23     isChecked,
24     beDeleted,
25     onClickCheckbox,
26     onClickDetails,
27     onToggleDelete,
28     ...rest
29 }: Props) => {
30     return (
31         <OrderableTableBody colSpan={4} {...rest} data-testid="merge-model:merge-table">
32             {contacts.map((Contact, i) => (
33                 <MergeTableBodyRow
34                     index={i}
35                     key={Contact.ID}
36                     ID={Contact.ID}
37                     Contact={Contact}
38                     highlightedID={highlightedID}
39                     isChecked={isChecked}
40                     beDeleted={beDeleted}
41                     onClickCheckbox={onClickCheckbox}
42                     onClickDetails={onClickDetails}
43                     onToggleDelete={onToggleDelete}
44                 />
45             ))}
46         </OrderableTableBody>
47     );
50 export default MergeTableBody;