2017-06-04 10:40:14 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2016-05-20 21:37:19 +08:00
|
|
|
import cx from 'classnames';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
iconName: PropTypes.string.isRequired,
|
|
|
|
prependIconName: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
const defaultProps = {
|
|
|
|
prependIconName: 'icon-bbb-',
|
|
|
|
};
|
|
|
|
|
|
|
|
export default class Icon extends Component {
|
|
|
|
render() {
|
|
|
|
const { className, prependIconName, iconName, ...otherProps } = this.props;
|
|
|
|
return (
|
|
|
|
<i
|
|
|
|
className={cx(className, [prependIconName, iconName].join(''))}
|
2017-06-03 03:25:02 +08:00
|
|
|
{...otherProps}
|
|
|
|
/>
|
2016-05-20 21:37:19 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Icon.propTypes = propTypes;
|
|
|
|
Icon.defaultProps = defaultProps;
|