UNPKG

tmemory

Version:

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

13 lines (12 loc) 899 B
import { Box, Text } from 'ink'; import React from 'react'; import { COLORS } from '../../../constants/colors.js'; import { useHighScores } from '../../../context/HighScoreContext/index.js'; import { formatTime } from '../../../utils/time.js'; export const HighScoreDisplay = ({ gameMode, gridDimension, }) => { const { getHighScore } = useHighScores(); const currentHighScore = getHighScore(gameMode, gridDimension); return (React.createElement(Box, { flexDirection: "column", alignItems: "center" }, currentHighScore ? (React.createElement(Box, { alignItems: "center", minWidth: 48, justifyContent: "center" }, React.createElement(Text, { color: COLORS.gold, bold: true }, "Best Time:"), React.createElement(Text, { color: COLORS.gold }, formatTime(currentHighScore.time)))) : (React.createElement(Text, { color: COLORS.dim, dimColor: true }, "No records yet!")))); };