1 import { library } from '@fortawesome/fontawesome-svg-core';
2 import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3 import { fab } from '@fortawesome/free-brands-svg-icons';
4 import { fas } from '@fortawesome/free-solid-svg-icons';
5 import React from 'react';
6 import PropTypes from 'prop-types';
7 import { withTranslation } from 'react-i18next';
9 import i18n from '../../i18n';
24 className={name === Icon.LOADING ? `${className} fa-spin` : className}
31 name: PropTypes.oneOfType([
33 PropTypes.arrayOf(PropTypes.string),
35 alt: PropTypes.string,
36 className: PropTypes.string,
37 size: PropTypes.string,
38 title: PropTypes.string,
48 const makePreset = (presetDisplayName, presetName) => {
49 const preset = ({ alt, className, name, size, title}) => <Icon
50 alt={alt || i18n.t(`icon.${presetDisplayName}`)}
52 name={name || presetName}
54 title={title !== '' ? title || alt || i18n.t(`icon.${presetDisplayName}`) : null}
56 preset.displayName = presetDisplayName;
57 return withTranslation()(preset);
60 Icon.DISCORD = makePreset('DiscordIcon', ['fab', 'discord']);
61 Icon.EDIT = makePreset('EditIcon', 'edit');
62 Icon.FINISHED = makePreset('FinishedIcon', 'square-check');
63 Icon.FIRST_PLACE = makePreset('FirstPlaceIcon', 'trophy');
64 Icon.FORFEIT = makePreset('ForfeitIcon', 'square-xmark');
65 Icon.LANGUAGE = makePreset('LanguageIcon', 'language');
66 Icon.LOCKED = makePreset('LockedIcon', 'lock');
67 Icon.LOGOUT = makePreset('LogoutIcon', 'sign-out-alt');
68 Icon.PENDING = makePreset('PendingIcon', 'clock');
69 Icon.PROTOCOL = makePreset('ProtocolIcon', 'file-alt');
70 Icon.SECOND_PLACE = makePreset('SecondPlaceIcon', 'medal');
71 Icon.STREAM = makePreset('StreamIcon', ['fab', 'twitch']);
72 Icon.THIRD_PLACE = makePreset('ThirdPlaceIcon', 'award');
73 Icon.UNLOCKED = makePreset('UnlockedIcon', 'lock-open');