summaryrefslogtreecommitdiff
path: root/src/components/Icon.js
blob: 806f4557164d0222d1c0b1e240b1a2b037f6ec8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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);