diff --git a/src/components/App/__snapshots__/test.js.snap b/src/components/App/__snapshots__/test.js.snap index 8cc359f..5910d8b 100644 --- a/src/components/App/__snapshots__/test.js.snap +++ b/src/components/App/__snapshots__/test.js.snap @@ -29,10 +29,19 @@ exports[`Message rendering 1`] = ` } />

- Placeholder app content + Sample error message +

+
+ +

+ Sample warning message

diff --git a/src/components/App/index.js b/src/components/App/index.js index b520908..9fda3e8 100644 --- a/src/components/App/index.js +++ b/src/components/App/index.js @@ -21,8 +21,11 @@ const App = () => downloadUrls={ downloadUrls } permalinkUrl="#permalink" onSubmit={ handleSubmit }/> - -

Placeholder app content

+ +

Sample error message

+
+ +

Sample warning message

; diff --git a/src/components/Message/__snapshots__/test.js.snap b/src/components/Message/__snapshots__/test.js.snap index 4ad466a..1c156eb 100644 --- a/src/components/Message/__snapshots__/test.js.snap +++ b/src/components/Message/__snapshots__/test.js.snap @@ -41,3 +41,25 @@ exports[`Message rendering with icon 1`] = ` `; + +exports[`Message rendering with type 1`] = ` +
+
+

+ + Testing +

+
+
+

+ Message content +

+
+
+`; diff --git a/src/components/Message/index.js b/src/components/Message/index.js index f2921c5..e898c36 100644 --- a/src/components/Message/index.js +++ b/src/components/Message/index.js @@ -3,10 +3,12 @@ import PropTypes from 'prop-types'; import style from './style.css'; -import AlertIcon from 'feather-icons/dist/icons/alert-octagon.svg'; +import ErrorIcon from 'feather-icons/dist/icons/alert-octagon.svg'; +import WarningIcon from 'feather-icons/dist/icons/alert-triangle.svg'; const iconTypes = { - error: AlertIcon + error: ErrorIcon, + warning: WarningIcon }; const renderIcon = (type, icon) => { @@ -33,7 +35,8 @@ const Message = ({ type, icon, heading, children }) => ( Message.propTypes = { type: PropTypes.oneOf([ - 'error' + 'error', + 'warning' ]), icon: PropTypes.oneOfType([ PropTypes.element, diff --git a/src/components/Message/style.css b/src/components/Message/style.css index 9a9e573..fd8e718 100644 --- a/src/components/Message/style.css +++ b/src/components/Message/style.css @@ -38,4 +38,10 @@ color: var(--color-white); } } + + &.warning { + & .header { + background: var(--color-orange); + } + } } diff --git a/src/components/Message/test.js b/src/components/Message/test.js index 7ffd3a0..a67186d 100644 --- a/src/components/Message/test.js +++ b/src/components/Message/test.js @@ -21,3 +21,12 @@ test('Message rendering with icon', () => { ); expect(component).toMatchSnapshot(); }); + +test('Message rendering with type', () => { + const component = render( + +

Message content

+
+ ); + expect(component).toMatchSnapshot(); +}); diff --git a/src/globals.css b/src/globals.css index 247cf04..c4d1c23 100644 --- a/src/globals.css +++ b/src/globals.css @@ -5,6 +5,7 @@ --color-black: #000; --color-white: #fff; --color-red: #b3151a; + --color-orange: #fa0; --gradient-green: linear-gradient(to bottom, var(--color-green) 0%,