yacd/src/components/Icon.js
haishanh 91ecdaa5dd update: convert more components to function ones
includes Input, Config, SideBard.

also removed react-redux Provider
2018-11-06 22:37:21 +08:00

22 lines
533 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
const Icon = ({ id, width = 20, height = 20, className, ...props }) => {
const c = cx('icon', id, className);
const href = '#' + id;
return (
<svg className={c} width={width} height={height} {...props}>
<use xlinkHref={href} />
</svg>
);
};
Icon.propTypes = {
id: PropTypes.string.isRequired,
width: PropTypes.number,
height: PropTypes.number,
className: PropTypes.string
};
export default React.memo(Icon);