From 0e52a59917406ad03c174e030c6c1c92ab23449d Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 30 Oct 2023 12:44:11 +0100
Subject: refactor(components): extract SettingsForm component form
 SettingsModal

We could use an array of items and map over it instead of repeating the
Switch component for each settings but with translations, it becomes
quickly unreadable. So I prefer to keep separate components.
---
 src/components/organisms/modals/settings-modal.tsx | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

(limited to 'src/components/organisms/modals/settings-modal.tsx')

diff --git a/src/components/organisms/modals/settings-modal.tsx b/src/components/organisms/modals/settings-modal.tsx
index 5fea491..94d69e2 100644
--- a/src/components/organisms/modals/settings-modal.tsx
+++ b/src/components/organisms/modals/settings-modal.tsx
@@ -1,12 +1,7 @@
 import { useCallback, type FC, type FormEvent } from 'react';
 import { useIntl } from 'react-intl';
-import { Form, Heading, Icon, Modal, type ModalProps } from '../../atoms';
-import {
-  AckeeToggle,
-  MotionToggle,
-  PrismThemeToggle,
-  ThemeToggle,
-} from '../forms';
+import { Heading, Icon, Modal, type ModalProps } from '../../atoms';
+import { SettingsForm } from '../forms';
 import styles from './settings-modal.module.scss';
 
 export type SettingsModalProps = Pick<ModalProps, 'className'>;
@@ -43,16 +38,7 @@ export const SettingsModal: FC<SettingsModalProps> = ({ className = '' }) => {
         </Heading>
       }
     >
-      <Form
-        aria-label={ariaLabel}
-        className={styles.form}
-        onSubmit={submitHandler}
-      >
-        <ThemeToggle className={styles.item} />
-        <PrismThemeToggle className={styles.item} />
-        <MotionToggle className={styles.item} />
-        <AckeeToggle className={styles.item} direction="upwards" />
-      </Form>
+      <SettingsForm aria-label={ariaLabel} onSubmit={submitHandler} />
     </Modal>
   );
 };
-- 
cgit v1.2.3

