Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / packages / components / containers / messages / AutoDeleteSpamAndTrashDaysToggle.tsx
blobab2c0272c3b8751abdbfb1ed22613b26f42a1ea1
1 import Toggle from '@proton/components/components/toggle/Toggle';
2 import { AUTO_DELETE_SPAM_AND_TRASH_DAYS } from '@proton/shared/lib/mail/mailSettings';
4 interface Props {
5     id?: string;
6     loading?: boolean;
7     autoDeleteSpamAndTrashDays?: number | null;
8     onToggle: (autoDeleteSpamAndTrashDays: number) => void;
9     dataTestID?: string;
12 const AutoDeleteSpamAndTrashDaysToggle = ({
13     id,
14     autoDeleteSpamAndTrashDays = AUTO_DELETE_SPAM_AND_TRASH_DAYS.DISABLED,
15     loading,
16     onToggle,
17     dataTestID,
18 }: Props) => {
19     return (
20         <Toggle
21             id={id}
22             checked={Boolean(autoDeleteSpamAndTrashDays)}
23             onChange={({ target }) =>
24                 onToggle(
25                     target.checked ? AUTO_DELETE_SPAM_AND_TRASH_DAYS.ACTIVE : AUTO_DELETE_SPAM_AND_TRASH_DAYS.DISABLED
26                 )
27             }
28             loading={loading}
29             data-testid={dataTestID}
30         />
31     );
34 export default AutoDeleteSpamAndTrashDaysToggle;