refactored ProgressCard to component
This commit is contained in:
23
src/components/ProgressCard/ProgressCard.tsx
Normal file
23
src/components/ProgressCard/ProgressCard.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import ProgressCardView from "./ProgressCard.view";
|
||||
import { ProgressCardProps } from "./ProgressCard.models";
|
||||
import { getPercentage, parseSummary } from "./ProgressCard.utils";
|
||||
|
||||
export default function ProgressCard(props: ProgressCardProps) {
|
||||
const { progressAmount, totalAmount, summary } = props;
|
||||
|
||||
const percentage = getPercentage(progressAmount, totalAmount);
|
||||
const { prefixAmount, suffixString } = parseSummary(
|
||||
summary,
|
||||
progressAmount,
|
||||
totalAmount
|
||||
);
|
||||
|
||||
return (
|
||||
<ProgressCardView
|
||||
{...props}
|
||||
percentage={percentage}
|
||||
prefixAmount={prefixAmount}
|
||||
suffixString={suffixString}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user