react-app-shell
Version:
react打包脚本和example, 这里的版本请忽略
26 lines (24 loc) • 802 B
JavaScript
import React, {Component} from 'react';
import classNames from 'classnames';
import styles from './toast.less';
class Notice extends Component {
render() {
const icons = {
info: 'icon-info-circle-fill',
success: 'icon-check-circle-fill',
warning: 'icon-warning-circle-fill',
error: 'icon-close-circle-fill',
loading: 'icon-loading'
};
const {type, content} = this.props;
return (
<div className={classNames(styles['toast-notice'], styles[type])}>
<svg className={styles['icon']} aria-hidden="true">
<use xlinkHref={`#${icons[type]}`}/>
</svg>
<div>{content}</div>
</div>
);
}
}
export default Notice;