diff --git a/web/modals/modal.react.js b/web/modals/modal.react.js index 06f047b2e..9446d8139 100644 --- a/web/modals/modal.react.js +++ b/web/modals/modal.react.js @@ -1,115 +1,115 @@ // @flow import classNames from 'classnames'; import invariant from 'invariant'; import * as React from 'react'; import SWMansionIcon, { type Icon } from '../SWMansionIcon.react'; import css from './modal.css'; export type ModalSize = 'small' | 'large'; type Props = { +name: React.Node, +icon?: Icon, +onClose: () => void, +withCloseButton?: boolean, +children?: React.Node, +size?: ModalSize, +fixedHeight?: boolean, }; class Modal extends React.PureComponent { static defaultProps: { +size: ModalSize, fixedHeight: boolean } = { size: 'small', fixedHeight: true, }; overlay: ?HTMLDivElement; componentDidMount() { invariant(this.overlay, 'overlay ref unset'); this.overlay.focus(); } render(): React.Node { const { size, children, onClose, fixedHeight, name, icon, - withCloseButton = false, + withCloseButton = true, } = this.props; const overlayClasses = classNames( css['modal-overlay'], { [css['small-modal-overlay']]: size === 'small' }, { [css['large-modal-overlay']]: size === 'large' }, { [css['resizable-modal-overlay']]: !fixedHeight }, ); const modalContainerClasses = classNames(css['modal-container'], { [css['large-modal-container']]: size === 'large', }); const modalClasses = classNames(css['modal'], { [css['fixed-height-modal']]: fixedHeight, }); let headerIcon; if (icon) { headerIcon = ; } let cornerCloseButton; if (withCloseButton) { cornerCloseButton = ( ); } return (
{cornerCloseButton}

{headerIcon} {name}

{children}
); } overlayRef: (overlay: ?HTMLDivElement) => void = overlay => { this.overlay = overlay; }; onBackgroundClick: ( event: SyntheticEvent, ) => void = event => { if (event.target === this.overlay) { this.props.onClose(); } }; onKeyDown: ( event: SyntheticKeyboardEvent, ) => void = event => { if (event.keyCode === 27) { this.props.onClose(); } }; } export default Modal; diff --git a/web/modals/threads/confirm-leave-thread-modal.react.js b/web/modals/threads/confirm-leave-thread-modal.react.js index 53e4ed869..eaf8d516a 100644 --- a/web/modals/threads/confirm-leave-thread-modal.react.js +++ b/web/modals/threads/confirm-leave-thread-modal.react.js @@ -1,41 +1,46 @@ // @flow import * as React from 'react'; import { type ThreadInfo } from 'lib/types/thread-types'; import Button from '../../components/button.react'; import Modal from '../modal.react'; import css from './confirm-leave-thread-modal.css'; type Props = { +threadInfo: ThreadInfo, +onClose: () => void, +onConfirm: () => void, }; function ConfirmLeaveThreadModal(props: Props): React.Node { const { threadInfo, onClose, onConfirm } = props; const { uiName } = threadInfo; return ( - +

{'Are you sure you want to leave "'} {uiName} {'"?'}

); } export default ConfirmLeaveThreadModal;