import { Typography, Statistic, Card, Col, Progress} from "antd"; const { Text } = Typography; interface ItemProps { title: string, value: string, prefix: JSX.Element, color: string, progress: boolean, }; export default function StatisticItem(props: ItemProps) { const { title, value, prefix } = props; const View = props.progress ? ProgressView : StatisticView; return (
); } function ProgressView({title, value, prefix, color}) { const endColor = value > 90 ? 'red' : color; const content = (
{prefix}
{title}
{value}%
) return ( content} /> ) } function StatisticView({title, value, prefix}) { const valueStyle = { color: "#334", fontSize: "1.8rem" }; return ( ) }