1 import { library } from '@fortawesome/fontawesome-svg-core';
2 import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3 import { faJsSquare } from '@fortawesome/free-brands-svg-icons';
4 import { fab } from '@fortawesome/free-brands-svg-icons';
5 import { fas } from '@fortawesome/free-solid-svg-icons';
6 import React from 'react';
7 import PropTypes from 'prop-types';
8 import { withTranslation } from 'react-i18next';
10 import i18n from '../../i18n';
12 library.add(faJsSquare);
26 className={name === Icon.LOADING ? `${className} fa-spin` : className}
33 name: PropTypes.oneOfType([
35 PropTypes.arrayOf(PropTypes.string),
37 alt: PropTypes.string,
38 className: PropTypes.string,
39 size: PropTypes.string,
40 title: PropTypes.string,
50 const makePreset = (presetDisplayName, presetName) => {
51 const preset = ({ alt, className, name, size, title}) => <Icon
52 alt={alt || i18n.t(`icon.${presetDisplayName}`)}
54 name={name || presetName}
56 title={title !== '' ? title || alt || i18n.t(`icon.${presetDisplayName}`) : null}
58 preset.displayName = presetDisplayName;
59 return withTranslation()(preset);
62 Icon.DISCORD = makePreset('DiscordIcon', ['fab', 'discord']);
63 Icon.LOGOUT = makePreset('LogoutIcon', 'sign-out-alt');
64 Icon.PROTOCOL = makePreset('ProtocolIcon', 'file-alt');