From 901982b129816dffd65d63a8b93ab4db15fc256f Mon Sep 17 00:00:00 2001 From: Manjit Singh Date: Thu, 14 Jan 2021 13:22:37 -0500 Subject: [PATCH] fix(community-modal): #403 fixed heading text overlap with close icon --- packages/Modal/Modal.jsx | 5 +- .../__snapshots__/Modal.spec.jsx.snap | 555 ++++++++++-------- packages/Modal/styles.jsx | 8 + 3 files changed, 317 insertions(+), 251 deletions(-) diff --git a/packages/Modal/Modal.jsx b/packages/Modal/Modal.jsx index edf80ef2a..0aa7d6bc6 100644 --- a/packages/Modal/Modal.jsx +++ b/packages/Modal/Modal.jsx @@ -17,6 +17,7 @@ import { ModalWrapper, PaddingOverride, OutlineButton, + StyledBox, } from './styles' const FocusTrap = withFocusTrap('div') @@ -112,12 +113,12 @@ const Modal = ({ - +
{modalHeading}
{description} -
+ {confirmCTAText && ( diff --git a/packages/Modal/__tests__/__snapshots__/Modal.spec.jsx.snap b/packages/Modal/__tests__/__snapshots__/Modal.spec.jsx.snap index a05b9e647..cc84e505e 100644 --- a/packages/Modal/__tests__/__snapshots__/Modal.spec.jsx.snap +++ b/packages/Modal/__tests__/__snapshots__/Modal.spec.jsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Modal renders 1`] = ` -.c5 { +.c6 { word-wrap: break-word; color: #2a2c2e; font-weight: 700; @@ -13,7 +13,7 @@ exports[`Modal renders 1`] = ` letter-spacing: -0.6px; } -.c5 sup { +.c6 sup { position: relative; vertical-align: baseline; padding-left: 0.1em; @@ -21,7 +21,7 @@ exports[`Modal renders 1`] = ` top: -0.5em; } -.c5 > span { +.c6 > span { -webkit-letter-spacing: inherit; -moz-letter-spacing: inherit; -ms-letter-spacing: inherit; @@ -35,7 +35,7 @@ exports[`Modal renders 1`] = ` flex-direction: column; } -.c4 { +.c5 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -45,18 +45,18 @@ exports[`Modal renders 1`] = ` flex-direction: column; } -.c4 > *:not(:last-child) { +.c5 > *:not(:last-child) { margin-bottom: 1rem; } -.c8 { +.c9 { display: block; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } -.c10 { +.c11 { border-width: 0; border-radius: 4px; word-wrap: break-word; @@ -93,17 +93,17 @@ exports[`Modal renders 1`] = ` color: #fff; } -.c10:hover { +.c11:hover { box-shadow: 0 0 0 1px; background-color: #fff; color: #2B8000; } -.c11 { +.c12 { width: 100%; } -.c6 { +.c7 { color: #2a2c2e; word-wrap: break-word; padding: 0; @@ -119,7 +119,7 @@ exports[`Modal renders 1`] = ` text-align: left; } -.c6 sup { +.c7 sup { top: -0.5em; font-size: 0.875rem; position: relative; @@ -127,7 +127,7 @@ exports[`Modal renders 1`] = ` padding-left: 0.1em; } -.c15 { +.c16 { position: absolute; height: 1px; width: 1px; @@ -136,7 +136,7 @@ exports[`Modal renders 1`] = ` clip: rect(1px,1px,1px,1px); } -.c16 { +.c17 { background-color: #d8d8d8; position: absolute; top: 0; @@ -152,14 +152,14 @@ exports[`Modal renders 1`] = ` transform: scale(0,0); } -.c13:focus .c16, -.c13:active .c16 { +.c14:focus .c17, +.c14:active .c17 { -webkit-transform: scale(1,1); -ms-transform: scale(1,1); transform: scale(1,1); } -.c17 { +.c18 { position: relative; top: 0; width: 24px; @@ -167,7 +167,7 @@ exports[`Modal renders 1`] = ` fill: #2a2c2e; } -.c14 { +.c15 { padding: 0; margin: 0; border-width: 0; @@ -198,11 +198,11 @@ exports[`Modal renders 1`] = ` -webkit-tap-highlight-color: transparent; } -.c14:focus::-moz-focus-inner { +.c15:focus::-moz-focus-inner { border: 0; } -.c14:hover svg { +.c15:hover svg { -webkit-transition: -webkit-transform 150ms ease-in-out; -webkit-transition: transform 150ms ease-in-out; transition: transform 150ms ease-in-out; @@ -211,7 +211,7 @@ exports[`Modal renders 1`] = ` transform: scale(1.1,1.1); } -.c14:active svg { +.c15:active svg { -webkit-transition: -webkit-transform 150ms ease-in-out; -webkit-transition: transform 150ms ease-in-out; transition: transform 150ms ease-in-out; @@ -252,11 +252,11 @@ exports[`Modal renders 1`] = ` margin: 1rem 0.5rem; } -.c7 > div:first-child { +.c8 > div:first-child { padding-bottom: 0rem; } -.c12 { +.c13 { float: right; padding: 1rem 1rem 0 0; position: absolute; @@ -294,6 +294,10 @@ exports[`Modal renders 1`] = ` justify-content: space-between; } +.c4 { + margin-top: 1rem; +} + @media (max-width:767px) { .c3 { padding-top: 2rem; @@ -313,21 +317,21 @@ exports[`Modal renders 1`] = ` } @media (max-width:767px) { - .c8 { + .c9 { padding-top: 1.5rem; padding-bottom: 1.5rem; } } @media (min-width:768px) { - .c8 { + .c9 { padding-top: 2rem; padding-bottom: 2rem; } } @media (min-width:768px) { - .c10 { + .c11 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; @@ -338,14 +342,14 @@ exports[`Modal renders 1`] = ` } @media (prefers-reduced-motion:reduce) { - .c16 { + .c17 { -webkit-transition: none; transition: none; } } @media (prefers-reduced-motion:reduce) { - .c14:hover > svg { + .c15:hover > svg { -webkit-transition: none; transition: none; } @@ -371,7 +375,7 @@ exports[`Modal renders 1`] = ` } @media (min-width:768px) { - .c9 { + .c10 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -381,11 +385,17 @@ exports[`Modal renders 1`] = ` flex-flow: row; } - .c9 > button:first-child { + .c10 > button:first-child { margin-right: 1rem; } } +@media (min-width:768px) { + .c4 { + margin-top: 0; + } +} + span { +.c6 > span { -webkit-letter-spacing: inherit; -moz-letter-spacing: inherit; -ms-letter-spacing: inherit; @@ -489,14 +499,14 @@ exports[`Modal renders 1`] = ` margin-bottom: 1rem; } -.c8 { +.c9 { display: block; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } -.c10 { +.c11 { border-width: 0; border-radius: 4px; word-wrap: break-word; @@ -533,17 +543,17 @@ exports[`Modal renders 1`] = ` color: #fff; } -.c10:hover { +.c11:hover { box-shadow: 0 0 0 1px; background-color: #fff; color: #2B8000; } -.c11 { +.c12 { width: 100%; } -.c6 { +.c7 { color: #2a2c2e; word-wrap: break-word; padding: 0; @@ -559,7 +569,7 @@ exports[`Modal renders 1`] = ` text-align: left; } -.c6 sup { +.c7 sup { top: -0.5em; font-size: 0.875rem; position: relative; @@ -567,7 +577,7 @@ exports[`Modal renders 1`] = ` padding-left: 0.1em; } -.c15 { +.c16 { position: absolute; height: 1px; width: 1px; @@ -576,7 +586,7 @@ exports[`Modal renders 1`] = ` clip: rect(1px,1px,1px,1px); } -.c16 { +.c17 { background-color: #d8d8d8; position: absolute; top: 0; @@ -592,14 +602,14 @@ exports[`Modal renders 1`] = ` transform: scale(0,0); } -.c13:focus .c16, -.c13:active .c16 { +.c14:focus .c17, +.c14:active .c17 { -webkit-transform: scale(1,1); -ms-transform: scale(1,1); transform: scale(1,1); } -.c17 { +.c18 { position: relative; top: 0; width: 24px; @@ -607,7 +617,7 @@ exports[`Modal renders 1`] = ` fill: #2a2c2e; } -.c14 { +.c15 { padding: 0; margin: 0; border-width: 0; @@ -638,11 +648,11 @@ exports[`Modal renders 1`] = ` -webkit-tap-highlight-color: transparent; } -.c14:focus::-moz-focus-inner { +.c15:focus::-moz-focus-inner { border: 0; } -.c14:hover svg { +.c15:hover svg { -webkit-transition: -webkit-transform 150ms ease-in-out; -webkit-transition: transform 150ms ease-in-out; transition: transform 150ms ease-in-out; @@ -651,7 +661,7 @@ exports[`Modal renders 1`] = ` transform: scale(1.1,1.1); } -.c14:active svg { +.c15:active svg { -webkit-transition: -webkit-transform 150ms ease-in-out; -webkit-transition: transform 150ms ease-in-out; transition: transform 150ms ease-in-out; @@ -692,11 +702,11 @@ exports[`Modal renders 1`] = ` margin: 1rem 0.5rem; } -.c7 > div:first-child { +.c8 > div:first-child { padding-bottom: 0rem; } -.c12 { +.c13 { float: right; padding: 1rem 1rem 0 0; position: absolute; @@ -734,6 +744,10 @@ exports[`Modal renders 1`] = ` justify-content: space-between; } +.c5 { + margin-top: 1rem; +} + @media (max-width:767px) { .c3 { padding-top: 2rem; @@ -753,21 +767,21 @@ exports[`Modal renders 1`] = ` } @media (max-width:767px) { - .c8 { + .c9 { padding-top: 1.5rem; padding-bottom: 1.5rem; } } @media (min-width:768px) { - .c8 { + .c9 { padding-top: 2rem; padding-bottom: 2rem; } } @media (min-width:768px) { - .c10 { + .c11 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; @@ -778,14 +792,14 @@ exports[`Modal renders 1`] = ` } @media (prefers-reduced-motion:reduce) { - .c16 { + .c17 { -webkit-transition: none; transition: none; } } @media (prefers-reduced-motion:reduce) { - .c14:hover > svg { + .c15:hover > svg { -webkit-transition: none; transition: none; } @@ -811,7 +825,7 @@ exports[`Modal renders 1`] = ` } @media (min-width:768px) { - .c9 { + .c10 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -821,11 +835,17 @@ exports[`Modal renders 1`] = ` flex-flow: row; } - .c9 > button:first-child { + .c10 > button:first-child { margin-right: 1rem; } } +@media (min-width:768px) { + .c5 { + margin-top: 0; + } +} +
A heading

Are you sure?

- - - + +

+ Are you sure? +

+
+ + +
+ + +
+ + div:first-child {", "padding-bottom: 0rem;", @@ -1345,7 +1402,7 @@ exports[`Modal renders 1`] = ` forwardedRef={null} >