X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fjs%2Fcomponents%2Fcommon%2FZeldaIcon.js;fp=resources%2Fjs%2Fcomponents%2Fcommon%2FZeldaIcon.js;h=c53f4fd68def288ae2f231e11dc65b486796237f;hb=f1c8c3cc53a09d1c261875d2f482b6e19bc48a9a;hp=84f2220672ce3e622031b96ea6064325df774ec8;hpb=e937f3f41b33ba94d36f898573df75a9cd10e5c0;p=alttp.git diff --git a/resources/js/components/common/ZeldaIcon.js b/resources/js/components/common/ZeldaIcon.js index 84f2220..c53f4fd 100644 --- a/resources/js/components/common/ZeldaIcon.js +++ b/resources/js/components/common/ZeldaIcon.js @@ -1,8 +1,8 @@ import PropTypes from 'prop-types'; import React from 'react'; -import { withTranslation } from 'react-i18next'; +import { useTranslation } from 'react-i18next'; -import i18n from '../../i18n'; +import Icon from './Icon'; const getIconURL = name => { switch (name) { @@ -64,17 +64,29 @@ const getIconURL = name => { } }; -const ZeldaIcon = ({ name }) => - - {i18n.t(`icon.zelda.${name}`)} -; +const ZeldaIcon = ({ name }) => { + const { t } = useTranslation(); + + const invert = name.startsWith('not-'); + const strippedName = invert ? name.substr(4) : name; + const title = t(`icon.zelda.${name}`); + + return + {title} + {invert ? + + + + : null} + ; +}; ZeldaIcon.propTypes = { name: PropTypes.string, }; -export default withTranslation()(ZeldaIcon); +export default ZeldaIcon;