summaryrefslogtreecommitdiff
path: root/frontend/src/components/game/CardImage.jsx
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2019-02-26 20:30:59 +0100
committerjbion <joffrey.bion@amadeus.com>2019-02-26 20:30:59 +0100
commit6c7724ddd48f518cbee0437fa36b105da3ce5852 (patch)
tree279d0f625d82c9d3d38d12ac6fce4b303e906f2f /frontend/src/components/game/CardImage.jsx
parentFix wonder images aspect ratio (diff)
downloadseven-wonders-6c7724ddd48f518cbee0437fa36b105da3ce5852.tar.gz
seven-wonders-6c7724ddd48f518cbee0437fa36b105da3ce5852.tar.bz2
seven-wonders-6c7724ddd48f518cbee0437fa36b105da3ce5852.zip
Add board and played cards
Diffstat (limited to 'frontend/src/components/game/CardImage.jsx')
-rw-r--r--frontend/src/components/game/CardImage.jsx19
1 files changed, 15 insertions, 4 deletions
diff --git a/frontend/src/components/game/CardImage.jsx b/frontend/src/components/game/CardImage.jsx
index 110d9883..3c8a9f07 100644
--- a/frontend/src/components/game/CardImage.jsx
+++ b/frontend/src/components/game/CardImage.jsx
@@ -1,15 +1,26 @@
import React from 'react';
import type { ApiCard } from '../../api/model';
-import './Hand.css'
+import './CardImage.css'
type CardImageProps = {
card: ApiCard,
- otherClasses: string
+ otherClasses: string,
+ highlightColor?: string
}
-export const CardImage = ({card, otherClasses}: CardImageProps) => {
+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}`}/>
+ className={`card-img ${otherClasses}`}
+ style={style}/>
};
+
+function highlightStyle(highlightColor?: string) {
+ if (highlightColor) {
+ return { boxShadow: `0 0 1rem 0.1rem ${highlightColor}` };
+ } else {
+ return {};
+ }
+}
bgstack15