diff --git a/src/components/Header/__snapshots__/test.js.snap b/src/components/Header/__snapshots__/test.js.snap index 245ce89..e9d2324 100644 --- a/src/components/Header/__snapshots__/test.js.snap +++ b/src/components/Header/__snapshots__/test.js.snap @@ -16,16 +16,9 @@ exports[`Header closing the Privacy Policy modal 1`] = ` shouldFocusAfterRender={true} shouldReturnFocusAfterClose={true} > - - +
- - +
- - +
- - +
- - +
- - +
`; +exports[`Message rendering with a close button 1`] = ` +
+
+

+ Testing +

+ +
+
+

+ Message content +

+
+
+`; + exports[`Message rendering with icon 1`] = `
{ return ; }; -const Message = ({ type, icon, heading, children }) => ( +const Message = ({ type, icon, heading, onClose, children }) => (
(
{ renderIcon(type, icon) }

{ heading }

+ { onClose && }
{ children } @@ -49,6 +53,7 @@ Message.propTypes = { PropTypes.func ]), heading: PropTypes.string.isRequired, + onClose: PropTypes.func, children: PropTypes.oneOfType([ PropTypes.arrayOf(PropTypes.node), PropTypes.node diff --git a/src/components/Message/style.module.css b/src/components/Message/style.module.css index 73bc5a5..7127de5 100644 --- a/src/components/Message/style.module.css +++ b/src/components/Message/style.module.css @@ -24,6 +24,22 @@ width: 2.8rem; vertical-align: bottom; } + + & button { + padding: 0; + margin: 0; + border: 0 none; + background: transparent; + color: var(--color-tan); + cursor: pointer; + float: right; + font-size: 0; + + &:hover, + &:active { + color: var(--color-white); + } + } } .content { @@ -56,7 +72,7 @@ & .header { background: var(--color-orange); - & svg { + & > svg { background: var(--color-black); color: var(--color-orange); } @@ -68,7 +84,7 @@ background: var(--color-blue); color: var(--color-white); - & svg { + & > svg { background: var(--color-white); color: var(--color-blue); } diff --git a/src/components/Message/test.js b/src/components/Message/test.js index aa83a12..348eae6 100644 --- a/src/components/Message/test.js +++ b/src/components/Message/test.js @@ -31,4 +31,13 @@ describe('Message', () => { ); expect(component).toMatchSnapshot(); }); + + test('rendering with a close button', () => { + const component = shallow( + +

Message content

+
+ ); + expect(component).toMatchSnapshot(); + }); }); diff --git a/src/components/PrivacyPolicy/__snapshots__/test.js.snap b/src/components/PrivacyPolicy/__snapshots__/test.js.snap index 22b6631..5c1a0a5 100644 --- a/src/components/PrivacyPolicy/__snapshots__/test.js.snap +++ b/src/components/PrivacyPolicy/__snapshots__/test.js.snap @@ -3,6 +3,7 @@ exports[`PrivacyPolicy rendering 1`] = ` ( - +export const PrivacyPolicy = ({ t, ...props }) => ( +

Regexper and the tools used to create it are all open source. If you are diff --git a/src/components/PrivacyPolicy/test.js b/src/components/PrivacyPolicy/test.js index abd057a..e26b427 100644 --- a/src/components/PrivacyPolicy/test.js +++ b/src/components/PrivacyPolicy/test.js @@ -7,7 +7,7 @@ import { PrivacyPolicy } from 'components/PrivacyPolicy'; describe('PrivacyPolicy', () => { test('rendering', () => { const component = shallow( - + ); expect(component).toMatchSnapshot(); });