Commit 080e6534 authored by chechunchi's avatar chechunchi

fix YgoCard

parent 2747fa3e
Pipeline #22475 passed with stages
in 13 minutes and 31 seconds
.skeleton-cover {
background-color: gray;
}
.ygo-card { .ygo-card {
aspect-ratio: var(--card-ratio); aspect-ratio: var(--card-ratio);
} }
...@@ -25,22 +25,12 @@ export const YgoCard: React.FC<Props> = (props) => { ...@@ -25,22 +25,12 @@ export const YgoCard: React.FC<Props> = (props) => {
} = props; } = props;
return useMemo( return useMemo(
() => ( () => (
<> <img
{code === 0 && !isBack ? ( className={classNames("ygo-card", className)}
<div src={getCardImgUrl(code, isBack)}
className={classNames("ygo-card", "skeleton-cover", className)} style={{ width, ...style }}
style={{ width, ...style }} onClick={onClick}
onClick={onClick} />
/>
) : (
<img
className={classNames("ygo-card", className)}
src={getCardImgUrl(code, isBack)}
style={{ width, ...style }}
onClick={onClick}
/>
)}
</>
), ),
[code] [code]
); );
...@@ -53,7 +43,7 @@ function getCardImgUrl(code: number, back = false) { ...@@ -53,7 +43,7 @@ function getCardImgUrl(code: number, back = false) {
import.meta.env.BASE_URL === "/" import.meta.env.BASE_URL === "/"
? NeosConfig.assetsPath ? NeosConfig.assetsPath
: `${import.meta.env.BASE_URL}${NeosConfig.assetsPath}`; : `${import.meta.env.BASE_URL}${NeosConfig.assetsPath}`;
if (back) { if (back || code === 0) {
return `${ASSETS_BASE}/card_back.jpg`; return `${ASSETS_BASE}/card_back.jpg`;
} }
return `${NeosConfig.cardImgUrl}/${code}.jpg`; return `${NeosConfig.cardImgUrl}/${code}.jpg`;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment