playball
Version:
Watch MLB games from the comfort of your terminal
21 lines • 841 B
JavaScript
import React from 'react';
import { useSelector } from "react-redux/lib/alternate-renderers.js";
import PropTypes from 'prop-types';
import { get } from "../config.js";
import { selectLineScore } from "../features/games.js";
const formatCount = (count, total) => '● '.repeat(count) + '○ '.repeat(total - count);
function Count({
align
}) {
const linescore = useSelector(selectLineScore);
const content = `B: {${get('color.ball')}-fg}${formatCount(linescore.balls, 4)}{/}\n` + `S: {${get('color.strike')}-fg}${formatCount(linescore.strikes, 3)}{/}\n` + `O: {${get('color.out')}-fg}${formatCount(linescore.outs, 3)}{/}`;
return /*#__PURE__*/React.createElement("box", {
align: align,
content: content,
tags: true
});
}
Count.propTypes = {
align: PropTypes.oneOf(['left', 'center', 'right'])
};
export default Count;