From 69ece75ce81b2d61873f7ee8734e1463748955f8 Mon Sep 17 00:00:00 2001 From: Greg Venech Date: Wed, 26 Apr 2017 17:00:51 -0400 Subject: [PATCH] feat: expose `icons` prop for icon modification Allow default icons to be overwritten, also extracts all svg content to remove noise from the components. The icons are now mini- stateless components that are `import`ed. --- src/banner/banner-search.jsx | 21 ++++++--------------- src/banner/banner.jsx | 27 ++++++++++++++++----------- src/icons/cross-icon.jsx | 11 +++++++++++ src/icons/cross.svg | 12 ------------ src/icons/hamburger-icon.jsx | 16 ++++++++++++++++ src/icons/hamburger.svg | 17 ----------------- src/icons/search-icon.jsx | 12 ++++++++++++ src/icons/search.svg | 13 ------------- 8 files changed, 61 insertions(+), 68 deletions(-) create mode 100644 src/icons/cross-icon.jsx delete mode 100644 src/icons/cross.svg create mode 100644 src/icons/hamburger-icon.jsx delete mode 100644 src/icons/hamburger.svg create mode 100644 src/icons/search-icon.jsx delete mode 100644 src/icons/search.svg diff --git a/src/banner/banner-search.jsx b/src/banner/banner-search.jsx index 98705d8..d2b21a6 100644 --- a/src/banner/banner-search.jsx +++ b/src/banner/banner-search.jsx @@ -7,6 +7,10 @@ export default class BannerSearch extends React.Component { blockName: PropTypes.string.isRequired, active: PropTypes.bool.isRequired, placeholder: PropTypes.string, + icons: PropTypes.shape({ + clear: PropTypes.node.isRequired, + search: PropTypes.node.isRequired + }), onToggle: PropTypes.func.isRequired } @@ -29,26 +33,13 @@ export default class BannerSearch extends React.Component { ) diff --git a/src/banner/banner.jsx b/src/banner/banner.jsx index bb1b027..375367a 100644 --- a/src/banner/banner.jsx +++ b/src/banner/banner.jsx @@ -3,6 +3,9 @@ import PropTypes from 'prop-types' import BannerSearch from './banner-search' import BannerSub from './banner-sub' import StandardLink from '../links/standard-link' +import HamburgerIcon from '../icons/hamburger-icon' +import CrossIcon from '../icons/cross-icon' +import SearchIcon from '../icons/search-icon' import './banner-style' export default class Banner extends React.Component { @@ -11,6 +14,11 @@ export default class Banner extends React.Component { className: PropTypes.string, logo: PropTypes.node, url: PropTypes.string.isRequired, + icons: PropTypes.shape({ + menu: PropTypes.node.isRequired, + clear: PropTypes.node.isRequired, + search: PropTypes.node.isRequired + }), link: PropTypes.oneOfType([ PropTypes.func, PropTypes.instanceOf(React.Component) @@ -29,7 +37,12 @@ export default class Banner extends React.Component { className: '', link: StandardLink, search: true, - links: [] + links: [], + icons: { + menu: , + clear: , + search: + } } state = { @@ -50,16 +63,7 @@ export default class Banner extends React.Component { @@ -72,6 +76,7 @@ export default class Banner extends React.Component { { this.props.search ? ( diff --git a/src/icons/cross-icon.jsx b/src/icons/cross-icon.jsx new file mode 100644 index 0000000..b02e2a3 --- /dev/null +++ b/src/icons/cross-icon.jsx @@ -0,0 +1,11 @@ +import React from 'react' + +export default props => ( + + + + + +) diff --git a/src/icons/cross.svg b/src/icons/cross.svg deleted file mode 100644 index f4dff60..0000000 --- a/src/icons/cross.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/src/icons/hamburger-icon.jsx b/src/icons/hamburger-icon.jsx new file mode 100644 index 0000000..c422fba --- /dev/null +++ b/src/icons/hamburger-icon.jsx @@ -0,0 +1,16 @@ +import React from 'react' + +export default props => ( + + + + + + + + + +) diff --git a/src/icons/hamburger.svg b/src/icons/hamburger.svg deleted file mode 100644 index bfc0703..0000000 --- a/src/icons/hamburger.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - -Artboard Copy 3 -Created with Sketch. - - - - - - - - diff --git a/src/icons/search-icon.jsx b/src/icons/search-icon.jsx new file mode 100644 index 0000000..1cbc839 --- /dev/null +++ b/src/icons/search-icon.jsx @@ -0,0 +1,12 @@ +import React from 'react' + +export default props => ( + + + + + + +) diff --git a/src/icons/search.svg b/src/icons/search.svg deleted file mode 100644 index cc89443..0000000 --- a/src/icons/search.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - -