blob: 48c5ffb828739b939f9dca7acb6eb5aac3e07af8 (
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
|
import * as React from 'react';
import { ThemeSwitcher } from '~/components/shared/ThemeSwitcher';
import { DOES_NOT_SUPPORT_FETCH, errors } from '~/misc/errors';
import s0 from './APIDiscovery.module.scss';
import Modal from './Modal';
type Props = {
isOpen: boolean;
onRequestClose: () => void;
children: React.ReactNode;
};
export default function APIDiscovery({ isOpen, onRequestClose, children }: Props) {
if (!window.fetch) {
const { detail } = errors[DOES_NOT_SUPPORT_FETCH];
const err = new Error(detail) as Error & { code?: number };
err.code = DOES_NOT_SUPPORT_FETCH;
throw err;
}
return (
<Modal
isOpen={isOpen}
className={s0.content}
overlayClassName={s0.overlay}
shouldCloseOnOverlayClick={false}
shouldCloseOnEsc={false}
onRequestClose={onRequestClose}
>
<div className={s0.container}>{children}</div>
<div className={s0.fixed}>
<ThemeSwitcher />
</div>
</Modal>
);
}
|