blob: 3c8a9f07a9a3801ae4865c22ed731a7b2b1fe443 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import React from 'react';
import type { ApiCard } from '../../api/model';
import './CardImage.css'
type CardImageProps = {
card: ApiCard,
otherClasses: string,
highlightColor?: string
}
export const CardImage = ({card, otherClasses, highlightColor}: CardImageProps) => {
const style = highlightStyle(highlightColor);
return <img src={`/images/cards/${card.image}`}
title={card.name}
alt={'Card ' + card.name}
className={`card-img ${otherClasses}`}
style={style}/>
};
function highlightStyle(highlightColor?: string) {
if (highlightColor) {
return { boxShadow: `0 0 1rem 0.1rem ${highlightColor}` };
} else {
return {};
}
}
|