Created
May 3, 2018 14:58
-
-
Save sephi-dev/6bb04165a91913edcc3b7783a407d6d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import PropTypes from "prop-types"; | |
import sprite from "./assets/sprite.svg"; | |
const defaultStyle = { | |
fill: "#000", | |
width: "25px", | |
height: "25px" | |
}; | |
const Svg = ({ style, id }) => ( | |
<svg style={style ? style : defaultStyle}> | |
<use xlinkHref={`${sprite}#${id}`} aria-hidden="true" /> | |
</svg> | |
); | |
Svg.propTypes = { | |
style: PropTypes.shape({}), | |
id: PropTypes.string.isRequired | |
}; | |
Svg.defaultProps = { | |
style: null | |
}; | |
export default Svg; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment