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.ADD = makePreset('AddIcon', 'circle-plus');
61 Icon.APPLY = makePreset('ApplyIcon', 'right-to-bracket');
62 Icon.DISCORD = makePreset('DiscordIcon', ['fab', 'discord']);
63 Icon.EDIT = makePreset('EditIcon', 'edit');
64 Icon.FINISHED = makePreset('FinishedIcon', 'square-check');
65 Icon.FIRST_PLACE = makePreset('FirstPlaceIcon', 'trophy');
66 Icon.FORFEIT = makePreset('ForfeitIcon', 'square-xmark');
67 Icon.LANGUAGE = makePreset('LanguageIcon', 'language');
68 Icon.LOCKED = makePreset('LockedIcon', 'lock');
69 Icon.LOGOUT = makePreset('LogoutIcon', 'sign-out-alt');
70 Icon.PENDING = makePreset('PendingIcon', 'clock');
71 Icon.PROTOCOL = makePreset('ProtocolIcon', 'file-alt');
72 Icon.RESULT = makePreset('ResultIcon', 'clock');
73 Icon.SECOND_PLACE = makePreset('SecondPlaceIcon', 'medal');
74 Icon.STREAM = makePreset('StreamIcon', ['fab', 'twitch']);
75 Icon.THIRD_PLACE = makePreset('ThirdPlaceIcon', 'award');
76 Icon.UNLOCKED = makePreset('UnlockedIcon', 'lock-open');