Removing SVG components

Sticking with importing data URIs for now
This commit is contained in:
Jeff Avallone
2018-02-11 06:51:54 -05:00
parent c368e9031f
commit 810b37aa47
7 changed files with 19 additions and 99 deletions
+2 -13
View File
@@ -1,19 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
//import style from './style.css';
const renderIcon = icon => {
if (!icon) {
return;
}
if (typeof icon === 'string') {
return <img src={ icon }/>;
} else {
const Icon = icon;
return <Icon/>;
}
return <img src={ icon }/>;
};
const Message = ({ icon, heading, children }) => (
@@ -24,11 +17,7 @@ const Message = ({ icon, heading, children }) => (
);
Message.propTypes = {
icon: PropTypes.oneOfType([
PropTypes.element,
PropTypes.func,
PropTypes.string
]),
icon: PropTypes.string,
heading: PropTypes.string.isRequired,
children: PropTypes.element.isRequired
};
+1 -2
View File
@@ -14,9 +14,8 @@ test('Message rendering', () => {
});
test('Message rendering with icon', () => {
const Icon = () => 'Sample icon SVG';
const component = renderer.create(
<Message heading="Testing" icon={ Icon }>
<Message heading="Testing" icon="sample-icon-url">
<p>Message content</p>
</Message>
);
@@ -18,7 +18,9 @@ exports[`Message rendering with icon 1`] = `
className="message"
>
<h2>
Sample icon SVG
<img
src="sample-icon-url"
/>
Testing
</h2>
<p>