az2497 | 644017c | 2017-08-10 17:49:40 +0300 | [diff] [blame] | 1 | import React from 'react'; |
| 2 | //import ReactDOMServer from 'react-dom/server'; |
| 3 | |
| 4 | const SVGIcon = ({name, onClick, label, className, iconClassName, labelClassName, labelPosition, color, disabled, ...other}) => { |
| 5 | let colorClass = (color !== '') ? '__' + color : ''; |
| 6 | let classes = `svg-icon-wrapper ${iconClassName} ${className} ${colorClass} ${onClick ? 'clickable' : ''} ${disabled ? 'disabled' : ''} ${labelPosition}`; |
| 7 | |
| 8 | let iconMock = ( |
| 9 | <div {...other} onClick={onClick} className={classes}> |
| 10 | <span className={`svg-icon __${name} ${disabled ? 'disabled' : ''}`} /> |
| 11 | {label && <span className={`svg-icon-label ${labelClassName}`}>{label}</span>} |
| 12 | </div> |
| 13 | ); |
| 14 | // console.log(ReactDOMServer.renderToStaticMarkup(iconMock)); |
| 15 | return iconMock; |
| 16 | }; |
| 17 | export default SVGIcon; |