X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fcommon%2FZeldaIcon.js;h=ef07b9207f3ecbc5bc0d9b28f76889b5be0a8495;hb=04af60ad0cd937639cf5e1a0a8d023d9c1eea152;hp=c53f4fd68def288ae2f231e11dc65b486796237f;hpb=f1c8c3cc53a09d1c261875d2f482b6e19bc48a9a;p=alttp.git diff --git a/resources/js/components/common/ZeldaIcon.js b/resources/js/components/common/ZeldaIcon.js index c53f4fd..ef07b92 100644 --- a/resources/js/components/common/ZeldaIcon.js +++ b/resources/js/components/common/ZeldaIcon.js @@ -27,6 +27,7 @@ const getIconURL = name => { case 'ether': case 'fairy': case 'fighter-shield': + case 'fighter-sword': case 'fire-rod': case 'fire-shield': case 'flippers': @@ -59,24 +60,46 @@ const getIconURL = name => { case 'small-key': case 'somaria': return `/item/${name}.png`; + case 'dungeon-ct': + case 'dungeon-dp': + case 'dungeon-ep': + case 'dungeon-gt': + case 'dungeon-hc': + case 'dungeon-ip': + case 'dungeon-mm': + case 'dungeon-pd': + case 'dungeon-sp': + case 'dungeon-sw': + case 'dungeon-th': + case 'dungeon-tr': + case 'dungeon-tt': + return `/dungeon/${name.substr(8)}.png`; + case 'crystal-switch': + case 'crystal-switch-blue': + case 'crystal-switch-red': + return `/icon/${name}.png`; default: return ''; } }; -const ZeldaIcon = ({ name }) => { +const ZeldaIcon = ({ name, title }) => { const { t } = useTranslation(); const invert = name.startsWith('not-'); const strippedName = invert ? name.substr(4) : name; - const title = t(`icon.zelda.${name}`); + const src = getIconURL(strippedName); + const alt = t(`icon.zelda.${name}`); + const realTitle = title !== '' ? title || alt : null; return - {title} + {src ? + {alt} + : null} {invert ? @@ -87,6 +110,7 @@ const ZeldaIcon = ({ name }) => { ZeldaIcon.propTypes = { name: PropTypes.string, + title: PropTypes.string, }; export default ZeldaIcon;