// eslint-disable-next-line import React, { useMemo, useState } from 'react'; import { CardDTO } from 'services'; import Card from '../Card/Card'; import './CardDetails.css'; interface CardProps { card: CardDTO; } // @TODO: add missing fields (loyalty, hand, etc) const CardDetails = ({ card }: CardProps) => { return (
{ card && (
Name: {card.name}
{ (!card.power && !card.toughness) ? null : (
P/T: {card.power || 0}/{card.toughness || 0}
) } { !card.manaCost ? null : (
Cost: {card.manaCost.replace(/\{|\}/g, '')}
) } { !card.convertedManaCost ? null : (
CMC: {card.convertedManaCost}
) } { !card.colorIdentity?.length ? null : (
Identity: {card.colorIdentity.join('')}
) } { !card.colors?.length ? null : (
Color(s): {card.colors.join('')}
) } { !card.types?.length ? null : (
Main Type: {card.types.join(', ')}
) } { !card.type ? null : (
Type: {card.type}
) } { !card.side ? null : (
Side: {card.side}
) } { !card.layout ? null : (
Layout: {card.layout}
) }
{card.text?.trim()}
{card.flavorText?.trim()}
) }
); } export default CardDetails;