Fix empty state for weapons
This commit is contained in:
parent
feb3b6c2ca
commit
ed00f43af3
4 changed files with 20 additions and 3 deletions
|
|
@ -156,6 +156,10 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|
||||||
|
&.Placeholder {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
import classnames from 'classnames'
|
import classNames from 'classnames'
|
||||||
|
|
||||||
import SearchModal from '~components/SearchModal'
|
import SearchModal from '~components/SearchModal'
|
||||||
import WeaponModal from '~components/WeaponModal'
|
import WeaponModal from '~components/WeaponModal'
|
||||||
|
|
@ -36,7 +36,7 @@ const WeaponUnit = (props: Props) => {
|
||||||
const locale =
|
const locale =
|
||||||
router.locale && ['en', 'ja'].includes(router.locale) ? router.locale : 'en'
|
router.locale && ['en', 'ja'].includes(router.locale) ? router.locale : 'en'
|
||||||
|
|
||||||
const classes = classnames({
|
const classes = classNames({
|
||||||
WeaponUnit: true,
|
WeaponUnit: true,
|
||||||
mainhand: props.unitType == 0,
|
mainhand: props.unitType == 0,
|
||||||
grid: props.unitType == 1,
|
grid: props.unitType == 1,
|
||||||
|
|
@ -73,6 +73,12 @@ const WeaponUnit = (props: Props) => {
|
||||||
setImageUrl(imgSrc)
|
setImageUrl(imgSrc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function placeholderImageUrl() {
|
||||||
|
return props.unitType == 0
|
||||||
|
? '/images/placeholder-main.png'
|
||||||
|
: '/images/placeholder-grid.png'
|
||||||
|
}
|
||||||
|
|
||||||
function awakeningImage() {
|
function awakeningImage() {
|
||||||
if (
|
if (
|
||||||
props.gridWeapon &&
|
props.gridWeapon &&
|
||||||
|
|
@ -366,7 +372,14 @@ const WeaponUnit = (props: Props) => {
|
||||||
{ultimaImages()}
|
{ultimaImages()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<img alt={weapon?.name.en} className="grid_image" src={imageUrl} />
|
<img
|
||||||
|
alt={weapon?.name.en}
|
||||||
|
className={classNames({
|
||||||
|
GridImage: true,
|
||||||
|
Placeholder: imageUrl === '',
|
||||||
|
})}
|
||||||
|
src={imageUrl !== '' ? imageUrl : placeholderImageUrl()}
|
||||||
|
/>
|
||||||
{props.editable ? (
|
{props.editable ? (
|
||||||
<span className="icon">
|
<span className="icon">
|
||||||
<PlusIcon />
|
<PlusIcon />
|
||||||
|
|
|
||||||
BIN
public/images/placeholder-grid.png
Normal file
BIN
public/images/placeholder-grid.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 615 B |
BIN
public/images/placeholder-main.png
Normal file
BIN
public/images/placeholder-main.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in a new issue