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