about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/icon.js
blob: 8f55a0115e9ec57db27e785a0ba7d2e891f726e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//  Package imports.
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';

//  This just renders a FontAwesome icon.
export default function Icon ({
  className,
  fullwidth,
  icon,
}) {
  const computedClass = classNames('icon', 'fa', { 'fa-fw': fullwidth }, `fa-${icon}`, className);
  return icon ? (
    <span
      aria-hidden='true'
      className={computedClass}
    />
  ) : null;
}

//  Props.
Icon.propTypes = {
  className: PropTypes.string,
  fullwidth: PropTypes.bool,
  icon: PropTypes.string,
};