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.ALLOWED = makePreset('AllowedIcon', 'square-check');
63 Icon.APPLY = makePreset('ApplyIcon', 'right-to-bracket');
64 Icon.APPLICATIONS = makePreset('ApplicationsIcon', 'person-running');
65 Icon.CHART = makePreset('ChartIcon', 'chart-line');
66 Icon.DISCORD = makePreset('DiscordIcon', ['fab', 'discord']);
67 Icon.EDIT = makePreset('EditIcon', 'edit');
68 Icon.FINISHED = makePreset('FinishedIcon', 'square-check');
69 Icon.FIRST_PLACE = makePreset('FirstPlaceIcon', 'trophy');
70 Icon.FORBIDDEN = makePreset('ForbiddenIcon', 'square-xmark');
71 Icon.FORFEIT = makePreset('ForfeitIcon', 'square-xmark');
72 Icon.LANGUAGE = makePreset('LanguageIcon', 'language');
73 Icon.LOCKED = makePreset('LockedIcon', 'lock');
74 Icon.LOGOUT = makePreset('LogoutIcon', 'sign-out-alt');
75 Icon.PENDING = makePreset('PendingIcon', 'clock');
76 Icon.PIN = makePreset('PinIcon', 'location-pin');
77 Icon.PROTOCOL = makePreset('ProtocolIcon', 'file-alt');
78 Icon.REJECT = makePreset('RejectIcon', 'square-xmark');
79 Icon.REMOVE = makePreset('RemoveIcon', 'square-xmark');
80 Icon.RESULT = makePreset('ResultIcon', 'clock');
81 Icon.SECOND_PLACE = makePreset('SecondPlaceIcon', 'medal');
82 Icon.SETTINGS = makePreset('SettingsIcon', 'cog');
83 Icon.STREAM = makePreset('StreamIcon', ['fab', 'twitch']);
84 Icon.THIRD_PLACE = makePreset('ThirdPlaceIcon', 'award');
85 Icon.TWITCH = makePreset('TwitchIcon', ['fab', 'twitch']);
86 Icon.UNKNOWN = makePreset('UnknownIcon', 'square-question');
87 Icon.UNLOCKED = makePreset('UnlockedIcon', 'lock-open');
88 Icon.VIDEO = makePreset('VideoIcon', 'video');
89 Icon.YOUTUBE = makePreset('YoutubeIcon', ['fab', 'youtube']);