Include fallback icon into the build
This commit is contained in:
@@ -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`
|
||||
}
|
||||
Reference in New Issue
Block a user