From 6c7724ddd48f518cbee0437fa36b105da3ce5852 Mon Sep 17 00:00:00 2001 From: jbion Date: Tue, 26 Feb 2019 20:30:59 +0100 Subject: Add board and played cards --- frontend/src/components/game/CardImage.jsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'frontend/src/components/game/CardImage.jsx') 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 {'Card + className={`card-img ${otherClasses}`} + style={style}/> }; + +function highlightStyle(highlightColor?: string) { + if (highlightColor) { + return { boxShadow: `0 0 1rem 0.1rem ${highlightColor}` }; + } else { + return {}; + } +} -- cgit