diff --git a/client/public/style.css b/client/public/style.css index dbf973bfe..16193538e 100644 --- a/client/public/style.css +++ b/client/public/style.css @@ -8,9 +8,12 @@ --blue-lighten-82: #a2c5ff; --silver-base: #f8f8f8; + --silver-lighten-99: #fcfcfc; --silver-darken-80: #cdcdcd; --silver-darken-87: #dedede; --silver-darken-94: #efefef; + + --grey-darken-33: #535353; } * { @@ -101,8 +104,8 @@ body:not(.loading) > .loader { /* */ .btn { - min-width: 92px; - height: 30px; + min-width: 120px; + height: 35px; border-radius: 3px; font-size: 13px; font-weight: bold; @@ -140,7 +143,7 @@ body:not(.loading) > .loader { } .btn-secondary { - color: #535353; + color: var(--grey-darken-33); box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.1); border: solid 1px var(--silver-darken-80); background-color: var(--silver-base); @@ -162,7 +165,7 @@ body:not(.loading) > .loader { } .btn + .btn { - margin-left: 10px; + margin-left: 15px; } /* diff --git a/client/resources/icons/Close.svg b/client/resources/icons/Close.svg new file mode 100644 index 000000000..0f98072f1 --- /dev/null +++ b/client/resources/icons/Close.svg @@ -0,0 +1,3 @@ + + + diff --git a/client/src/app/primitives/__tests__/ModalSpec.js b/client/src/app/primitives/__tests__/ModalSpec.js index 290080aaa..18cdccd47 100644 --- a/client/src/app/primitives/__tests__/ModalSpec.js +++ b/client/src/app/primitives/__tests__/ModalSpec.js @@ -81,7 +81,7 @@ describe('', function() { }); - it('should invoke passed onClose prop for background click', function() { + it('should NOT invoke passed onClose prop for background click', function() { // given wrapper = mount(); @@ -90,7 +90,7 @@ describe('', function() { wrapper.first().simulate('click'); // then - expect(onCloseSpy).to.be.called; + expect(onCloseSpy).to.not.be.called; }); diff --git a/client/src/app/primitives/modal/Modal.js b/client/src/app/primitives/modal/Modal.js index 6759d0321..281751e9d 100644 --- a/client/src/app/primitives/modal/Modal.js +++ b/client/src/app/primitives/modal/Modal.js @@ -16,6 +16,8 @@ import classNames from 'classnames'; import FocusTrap from './FocusTrap'; import EscapeTrap from './EscapeTrap'; +import CloseIcon from '../../../../resources/icons/Close.svg'; + import css from './Modal.less'; @@ -60,21 +62,15 @@ export default class Modal extends PureComponent { } = this.props; return ReactDOM.createPortal( -
+
- { onClose && () } { children } + { onClose && () }
, document.body ); } - - handleBackgroundClick = event => { - if (event.target === event.currentTarget) { - this.close(); - } - }; } Modal.Body = Body; @@ -104,9 +100,9 @@ function Close(props) { } = props; return ( - - × - + ); } diff --git a/client/src/app/primitives/modal/Modal.less b/client/src/app/primitives/modal/Modal.less index 1feec5c6b..04cf1e39f 100644 --- a/client/src/app/primitives/modal/Modal.less +++ b/client/src/app/primitives/modal/Modal.less @@ -21,27 +21,88 @@ :local(.ModalContainer) { position: fixed; - margin: 10% auto; left: 0; right: 0; - max-width: 600px; - height: auto; - background: white; - box-shadow: 0 1px 4px rgba(0,0,0,0.3); - border-radius: 2px; - padding: 20px; + + width: 636px; + + margin: 10vh auto 6vh; + padding: 0; z-index: 1001; + /* ensures round corners are properly cut */ + overflow: hidden; + border: solid 1px var(--silver-darken-87); + border-radius: 3px; + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + + background-color: var(--silver-lighten-99); + color: var(--grey-darken-33); + + &, + & > form { + display: flex; + flex: auto; + flex-direction: column; + + max-height: 84vh; + } + + /* Content */ + + .modal-header { + padding: 20px 60px 20px 20px; + + background-color: var(--silver-base); + font-size: 16px; + + border-bottom: solid 1px var(--silver-darken-87); + + .modal-title { + margin: 0; + + font-size: 16px; + font-weight: bold; + } + } + + .modal-body { + padding: 10px 30px 20px 20px; + + overflow-y: auto; + + font-size: 14px; + } + + .modal-footer { + padding: 15px 20px; + + border-top: solid 1px var(--silver-darken-87); + + text-align: right; + } + + /* Close button */ + .close { - vertical-align: middle; - font-size: 2rem; - line-height: 2rem; position: absolute; - top: 15px; - right: 15px; + top: 20px; + right: 20px; + + width: 22px; + height: 22px; + padding: 0; + + border: none; + border-radius: 3px; + background-color: transparent; &:hover { - color: orange; + background-color: var(--silver-darken-94) + } + + &:focus { + background-color: var(--silver-darken-87); } } } diff --git a/client/src/plugins/privacy-preferences/PrivacyPreferences.js b/client/src/plugins/privacy-preferences/PrivacyPreferences.js index 5f2e634c9..664ac2e14 100644 --- a/client/src/plugins/privacy-preferences/PrivacyPreferences.js +++ b/client/src/plugins/privacy-preferences/PrivacyPreferences.js @@ -84,7 +84,7 @@ export default class PrivacyPreferences extends PureComponent { onClose={ this.onClose } preferences={ preferences } onSaveAndClose={ this.onSaveAndClose } - hasCancel={ !isInitialPreferences } /> + canCloseWithoutSave={ !isInitialPreferences } /> } ; } diff --git a/client/src/plugins/privacy-preferences/PrivacyPreferencesView.js b/client/src/plugins/privacy-preferences/PrivacyPreferencesView.js index 89b9ec588..8db73032f 100644 --- a/client/src/plugins/privacy-preferences/PrivacyPreferencesView.js +++ b/client/src/plugins/privacy-preferences/PrivacyPreferencesView.js @@ -70,11 +70,11 @@ class PrivacyPreferencesView extends PureComponent { const { onClose, onSaveAndClose, - hasCancel + canCloseWithoutSave } = this.props; return ( - + { TITLE } @@ -100,7 +100,7 @@ class PrivacyPreferencesView extends PureComponent {
- { hasCancel && ( + { canCloseWithoutSave && ( diff --git a/client/src/plugins/privacy-preferences/__tests__/PrivacyPreferencesViewSpec.js b/client/src/plugins/privacy-preferences/__tests__/PrivacyPreferencesViewSpec.js index 642581791..8d5693dac 100644 --- a/client/src/plugins/privacy-preferences/__tests__/PrivacyPreferencesViewSpec.js +++ b/client/src/plugins/privacy-preferences/__tests__/PrivacyPreferencesViewSpec.js @@ -91,9 +91,9 @@ describe('', function() { }); - it('should render cancel button is prop set', function() { + it('should render cancel button if prop is set', function() { - wrapper = mount(); + wrapper = mount(); const cancel = wrapper.find('.btn').at(1); @@ -194,7 +194,7 @@ describe('', function() { const wrapper = mount( {} } onSaveAndClose={ onSaveAndClose } /> );