diff --git a/web/modals/modal.react.js b/web/modals/modal.react.js
index 3b66a8c52..1f68556c3 100644
--- a/web/modals/modal.react.js
+++ b/web/modals/modal.react.js
@@ -1,103 +1,108 @@
// @flow
import classNames from 'classnames';
import * as React from 'react';
import SWMansionIcon, { type Icon } from '../SWMansionIcon.react';
import css from './modal.css';
export type ModalSize = 'small' | 'large' | 'fit-content';
-type Props = {
+
+export type ModalOverridableProps = {
+name: string,
+icon?: Icon,
+onClose: () => void,
+withCloseButton?: boolean,
- +children?: React.Node,
+size?: ModalSize,
};
-function Modal(props: Props): React.Node {
+type ModalProps = {
+ ...ModalOverridableProps,
+ +children?: React.Node,
+};
+
+function Modal(props: ModalProps): React.Node {
const {
size = 'small',
children,
onClose,
name,
icon,
withCloseButton = true,
} = props;
const overlayRef = React.useRef();
const onBackgroundClick = React.useCallback(
event => {
if (event.target === overlayRef.current) {
onClose();
}
},
[onClose],
);
const onKeyDown = React.useCallback(
event => {
if (event.keyCode === 27) {
onClose();
}
},
[onClose],
);
React.useEffect(() => {
if (overlayRef.current) {
overlayRef.current.focus();
}
}, []);
const modalContainerClasses = React.useMemo(
() =>
classNames(css.modalContainer, {
[css.modalContainerLarge]: size === 'large',
[css.modalContainerSmall]: size === 'small',
}),
[size],
);
const cornerCloseButton = React.useMemo(() => {
if (!withCloseButton) {
return null;
}
return (