taro-icons
Version:
基于 Taro 的小程序图标库
36 lines (33 loc) • 788 B
JavaScript
/**
* Created by Jeepeng on 2018/10/12.
*/
import React, { PureComponent } from 'react';
import { Text } from '@tarojs/components';
import PropTypes from 'prop-types'
class BaseIcon extends PureComponent {
static options = {
addGlobalClass: true
}
static propTypes = {
name: PropTypes.string.isRequired,
size: PropTypes.number,
color: PropTypes.string,
};
static defaultProps = {
color: '#000000',
size: 24,
};
render() {
const { prefixClass, name, color, size } = this.props;
const className = `${prefixClass} ${prefixClass}-${name}`;
const style = `font-size:${size}px;color:${color};`;
return (
<Text
className={className}
value={name}
style={style}
/>
);
}
}
export default BaseIcon;