UNPKG

tmemory

Version:

A terminal-based Memory card game built with React Ink. Features multiple grid sizes, AI opponent, and high scores.

14 lines (13 loc) 592 B
import React from 'react'; import { Card as InkCard, MiniCard } from 'ink-playing-cards'; import { getCardVariant } from "../../../utils/grid.js"; export const CardWrapper = ({ card, gridDimension, faceUp, selected, }) => { const { component, variant } = getCardVariant(gridDimension); const commonProps = { suit: card.suit, value: card.value, faceUp, selected, }; return component === 'MiniCard' ? (React.createElement(MiniCard, { ...commonProps, variant: variant })) : (React.createElement(InkCard, { ...commonProps, variant: variant })); };