1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| import React, { Component, PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames';
export default class Icon extends (PureComponent || Component) { static propTypes = { type: PropTypes.string.isRequired, className: PropTypes.string, spin: PropTypes.bool };
static defaultProps = { className: '', spin: false };
render() { const { type, className, spin, ...otherProps } = this.props; const cls = cx('zenticon', `zenticon-${type}`, className, { 'zenticon-spin': spin });
return <i className={cls} {...otherProps} />; } }
|