summaryrefslogtreecommitdiff
path: root/src/components/Icon.js
blob: a14d4e84766abb50bfd3b848d473e86bf19c4fa0 (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 'clsx';

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);