24 lines
729 B
TypeScript
24 lines
729 B
TypeScript
import * as React from "react";
|
|
import ProgressCardView from "./ProgressCard.view";
|
|
import { ProgressCardProps } from "./ProgressCard.models";
|
|
import { getPercentage, formatCurrency } from "./ProgressCard.utils";
|
|
|
|
export default function ProgressCard(props: ProgressCardProps) {
|
|
const { progressAmount, totalAmount, compact = false } = props;
|
|
|
|
const percentage = getPercentage(progressAmount, totalAmount);
|
|
|
|
const formattedProgress = formatCurrency(progressAmount);
|
|
const formattedTotal = formatCurrency(totalAmount);
|
|
|
|
return (
|
|
<ProgressCardView
|
|
{...props}
|
|
percentage={percentage}
|
|
formattedProgress={formattedProgress}
|
|
formattedTotal={formattedTotal}
|
|
compact={compact}
|
|
/>
|
|
);
|
|
}
|