Include fallback icon into the build

This commit is contained in:
Melvin Valster
2019-07-26 21:38:31 +02:00
parent 96b39835b5
commit 60e3c5d8f9
9 changed files with 12 additions and 5 deletions
+9 -2
View File
@@ -18,7 +18,7 @@ export const Icon = React.forwardRef<HTMLDivElement, Props>((props, ref) => {
const [name, setName] = useState(defaultName)
const bgSize = size !== 'small' ? 'large' : 'medium'
const url = name && `https://wow.zamimg.com/images/wow/icons/${bgSize}/${name}.jpg`
const url = name && iconUrl(name, bgSize)
const start = Date.now()
@@ -51,4 +51,11 @@ export const Icon = React.forwardRef<HTMLDivElement, Props>((props, ref) => {
{children}
</div>
)
})
})
const iconUrl = (name: string, size: string): string => {
if (name === NOT_FOUND_ICON) {
return require(`../images/icons/${size}/${name}.jpg`)
}
return `https://wow.zamimg.com/images/wow/icons/${size}/${name}.jpg`
}