about summary refs log blame commit diff
path: root/app/javascript/flavours/glitch/components/icon.js
blob: 8f55a0115e9ec57db27e785a0ba7d2e891f726e7 (plain) (tree)
























                                                                                                  
//  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,
};