1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { useTranslation } from 'react-i18next';
5 import Icon from './Icon';
7 const getIconURL = name => {
10 case 'blue-boomerang':
29 case 'fighter-shield':
40 case 'heart-container':
62 return `/item/${name}.png`;
76 return `/dungeon/${name.substr(8)}.png`;
77 case 'crystal-switch':
78 case 'crystal-switch-blue':
79 case 'crystal-switch-red':
80 return `/icon/${name}.png`;
86 const ZeldaIcon = ({ name, title }) => {
87 const { t } = useTranslation();
89 const invert = name.startsWith('not-');
90 const strippedName = invert ? name.substr(4) : name;
91 const src = getIconURL(strippedName);
92 const alt = t(`icon.zelda.${name}`);
93 const realTitle = title !== '' ? title || alt : null;
95 return <span className="zelda-icon">
104 <span className="strike">
105 <Icon.SLASH title="" />
111 ZeldaIcon.propTypes = {
112 name: PropTypes.string,
113 title: PropTypes.string,
116 export default ZeldaIcon;