icon.jsx 459 B

123456789101112131415161718192021
  1. import React, {PureComponent} from 'react';
  2. export default class Icon extends PureComponent {
  3. render() {
  4. const {className, glyph, width, height, ...restProps} = this.props;
  5. const viewBox = `0 0 ${width} ${height}`;
  6. return (
  7. <svg className={className} viewBox={viewBox} {...restProps}>
  8. <use xlinkHref={`#${glyph}`} />
  9. </svg>
  10. );
  11. }
  12. }
  13. Icon.defaultProps = {
  14. glyph: '',
  15. width: 16,
  16. height: 16,
  17. className: 'icon'
  18. };