Skip to content

Commit

Permalink
Merge pull request #393 from Gympass/feat/dialog
Browse files Browse the repository at this point in the history
Fix problem on Dialog
  • Loading branch information
coelhucas committed Nov 11, 2021
2 parents 8db60a1 + cdd9882 commit 717e2db
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions packages/yoga/src/Dialog/web/Dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,23 @@ const Dialog = ({ isOpen, children, onClose }) => {
return () => document.removeEventListener('keydown', keyPress);
}, [keyPress]);

return isOpen
? createPortal(
<Overlay onClick={closeDialog} onClose={onClose} ref={dialogRef}>
<StyledDialog onClose={onClose}>
{onClose && (
<Box d="flex" justifyContent="flex-end" w="100%">
<Button.Icon icon={Close} inverted onClick={onClose} />
</Box>
)}
{children}
</StyledDialog>
</Overlay>,
dialogElement,
)
: null;
return isOpen ? (
createPortal(
<Overlay onClick={closeDialog} onClose={onClose} ref={dialogRef}>
<StyledDialog onClose={onClose}>
{onClose && (
<Box d="flex" justifyContent="flex-end" w="100%">
<Button.Icon icon={Close} inverted onClick={onClose} />
</Box>
)}
{children}
</StyledDialog>
</Overlay>,
dialogElement,
)
) : (
<> </>
);
};

Dialog.propTypes = {
Expand Down

0 comments on commit 717e2db

Please sign in to comment.