]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/techniques/Rulesets.js
svg dungeon tracker
[alttp.git] / resources / js / components / techniques / Rulesets.js
1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { useTranslation } from 'react-i18next';
4
5 import Icon from '../common/Icon';
6
7 const Rulesets = ({ technique }) => {
8         const { t } = useTranslation();
9
10         return <div className="ruleset-box">
11                 {['competitive', 'owg', 'mg', 'nl'].map(r =>
12                         <span key={r} title={t(`techniques.rulesetDescriptions.${r}`)}>
13                                 {technique && technique.rulesets && technique.rulesets[r] ?
14                                         <Icon.ALLOWED className="text-success" />
15                                 : null}
16                                 {technique && technique.rulesets && !technique.rulesets[r] ?
17                                         <Icon.FORBIDDEN className="text-danger" />
18                                 : null}
19                                 {!technique || !technique.rulesets ?
20                                         <Icon.UNKNOWN />
21                                 : null}
22                                 {' '}
23                                 {t(`techniques.rulesetCodes.${r}`)}
24                         </span>
25                 )}
26         </div>;
27 };
28
29 Rulesets.propTypes = {
30         technique: PropTypes.shape({
31                 rulesets: PropTypes.shape({
32                 }),
33         }),
34 };
35
36 export default Rulesets;