UNPKG

@shawnsandy/svg-icons-kit

Version:

Use SvG icons/iconsets with react components

1 lines 1.3 kB
webpackJsonp([1],{0:function(e,t,n){{var r=n(82),o=n(84),i=n(58);n(83)}SvgIconset=r.createClass({displayName:"SvgIconset",propTypes:{size:r.PropTypes.string,name:r.PropTypes.string,iconID:r.PropTypes.string,iconsetUrl:r.PropTypes.string},getDefaultProps:function(){return{iconID:"beenhere",size:"48",style:{fill:""},iconsetUrl:"",svgRef:"svgbox",svg:""}},componentWillMount:function(){},componentDidMount:function(){var e=(this.props.svgRef,this.props.iconsetUrl,"#"+this.props.iconID);i.ajax({type:"GET",url:this.props.iconsetUrl,dataType:"xml",success:function(t){var n=i(t).find(e);console.log(n.html()+"xml data"),i(e).html(n.html())}.bind(this)})},render:function(){var e={fill:this.props.fill,verticalAlign:"middle",width:this.props.size,height:this.props.size};return r.createElement("svg",{id:this.props.iconID,className:this.props.iconID,viewBox:"0 0 24 24",preserveAspectRatio:"xMidYMid meet",style:o(this.props.style,e),ref:"svgbox"})}}),e.exports=SvgIconset},84:function(e,t,n){"use strict";function r(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=Object.assign||function(e,t){for(var n,o,i=r(e),a=1;a<arguments.length;a++){n=arguments[a],o=Object.keys(Object(n));for(var s=0;s<o.length;s++)i[o[s]]=n[o[s]]}return i}}});