From 94e73c0302f7b64369c79c002c3582be7931546f Mon Sep 17 00:00:00 2001 From: Mathew Morris Date: Wed, 8 Jan 2020 13:01:11 -0600 Subject: [PATCH] feat(Modal): Only renders modal in DOM when visible (#95) --- src/Modal/Modal.js | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/Modal/Modal.js b/src/Modal/Modal.js index 178decd..f08b928 100644 --- a/src/Modal/Modal.js +++ b/src/Modal/Modal.js @@ -6,8 +6,8 @@ import { Transition } from 'react-transition-group'; import { FocusOn } from 'react-focus-on'; import Portal from '../Portal'; import Flex from '../Flex'; -import Box from '../Box'; import Icon from '../Icon'; +import Button from '../Button'; import { createComponent, themeGet } from '../utils'; const ModalContext = createContext({}); @@ -103,7 +103,7 @@ export function Modal({ children, title, animationDuration, showClose, onClose, return ( - + {state => ( @@ -185,27 +185,21 @@ Modal.Header = ({ title, children, showClose = true }) => { - {title && ( - - {title} - - )} + {title && {title}} {children} {showClose && ( - - - + )}