diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-10-27 11:09:38 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-11 18:15:27 +0100 |
| commit | 757201fdc5c04a3f15504f74bf8ab85bb6018c2b (patch) | |
| tree | 1adda54704314b24ec81bfdbf0c13acbce2cda87 /src/components/organisms/modals/settings-modal.tsx | |
| parent | 3ab9f0423e97af63da4bf6a13ffd786955bd5b3b (diff) | |
refactor(hooks,provider): move reduce motion setter
Since the local storage key is not meant to change between the
components, it should be set directly inside the app file. So
both the local storage and the data attribute should be handle
in a provider.
I also added a custom document because we need a script to
retrieve the stored value in local storage earlier to avoid
flashing on hydration.
Diffstat (limited to 'src/components/organisms/modals/settings-modal.tsx')
| -rw-r--r-- | src/components/organisms/modals/settings-modal.tsx | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/components/organisms/modals/settings-modal.tsx b/src/components/organisms/modals/settings-modal.tsx index f62312b..5fea491 100644 --- a/src/components/organisms/modals/settings-modal.tsx +++ b/src/components/organisms/modals/settings-modal.tsx @@ -4,28 +4,19 @@ import { Form, Heading, Icon, Modal, type ModalProps } from '../../atoms'; import { AckeeToggle, MotionToggle, - type MotionToggleProps, PrismThemeToggle, ThemeToggle, } from '../forms'; import styles from './settings-modal.module.scss'; -export type SettingsModalProps = Pick<ModalProps, 'className'> & { - /** - * The local storage key for Reduce motion settings. - */ - motionStorageKey: MotionToggleProps['storageKey']; -}; +export type SettingsModalProps = Pick<ModalProps, 'className'>; /** * SettingsModal component * * Render a modal with settings options. */ -export const SettingsModal: FC<SettingsModalProps> = ({ - className = '', - motionStorageKey, -}) => { +export const SettingsModal: FC<SettingsModalProps> = ({ className = '' }) => { const intl = useIntl(); const title = intl.formatMessage({ defaultMessage: 'Settings', @@ -59,11 +50,7 @@ export const SettingsModal: FC<SettingsModalProps> = ({ > <ThemeToggle className={styles.item} /> <PrismThemeToggle className={styles.item} /> - <MotionToggle - className={styles.item} - defaultValue="on" - storageKey={motionStorageKey} - /> + <MotionToggle className={styles.item} /> <AckeeToggle className={styles.item} direction="upwards" /> </Form> </Modal> |
