zent
Version:
一套前端设计语言和基于React的实现
26 lines (21 loc) • 616 B
JavaScript
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} />;
}
}