aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/modals/settings-modal.tsx
blob: 0ab6b7abad6cd52634ebf3e11226b9530af332c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import Spinner from '@components/atoms/loaders/spinner';
import Modal, { type ModalProps } from '@components/molecules/modals/modal';
import dynamic from 'next/dynamic';
import { FC } from 'react';
import { useIntl } from 'react-intl';
import { type SettingsFormProps } from '../forms/settings-form';

const DynamicSettingsForm = dynamic(
  () => import('@components/organisms/forms/settings-form'),
  {
    loading: () => <Spinner />,
    ssr: false,
  }
);

export type SettingsModalProps = Pick<ModalProps, 'className'> &
  Pick<
    SettingsFormProps,
    'ackeeStorageKey' | 'motionStorageKey' | 'tooltipClassName'
  >;

/**
 * SettingsModal component
 *
 * Render a modal with settings options.
 */
const SettingsModal: FC<SettingsModalProps> = ({
  className = '',
  ...props
}) => {
  const intl = useIntl();
  const title = intl.formatMessage({
    defaultMessage: 'Settings',
    description: 'SettingsModal: title',
    id: 'gPfT/K',
  });

  return (
    <Modal title={title} icon="cogs" className={className}>
      <DynamicSettingsForm {...props} />
    </Modal>
  );
};

export default SettingsModal;