blob: a37595adba1b33bd18009072d5443ce220b7622f (
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 { 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 {};
}
}
|