Skip to content

Commit f2cedda

Browse files
authored
Merge pull request #6877 from Namanv0509/plancard-fix
Plancard currency fix
2 parents e8c14b7 + 0d04488 commit f2cedda

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/components/Pricing/PlanCard/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import PlanCardWrapper from "./planCard.style";
55
import FeatureDetails from "./collapsible-details";
66
import { Currencies, formatAndConvertPrice } from "../../../utils/currencies";
77

8-
9-
const PlanCard = ({ planData , isYearly ,currency }) => {
10-
11-
8+
const PlanCard = ({ planData, isYearly, currency }) => {
129
if (!planData || !Array.isArray(planData) || planData.length === 0) {
1310
return <div>No plan data available</div>;
1411
}
@@ -20,8 +17,12 @@ const PlanCard = ({ planData , isYearly ,currency }) => {
2017
};
2118

2219
const formatPrice = (price) => {
23-
console.log("price",price,planData);
24-
return formatAndConvertPrice(price, currency);
20+
const formattedPrice = formatAndConvertPrice(price, currency);
21+
// Remove the currency symbol by extracting only the numeric part
22+
return parseFloat(formattedPrice.replace(/[^0-9.]/g, ""));
23+
};
24+
const getCurrencySymbol = (currency) => {
25+
return Currencies[currency]?.symbol ?? "$";
2526
};
2627

2728
return (
@@ -50,11 +51,12 @@ const PlanCard = ({ planData , isYearly ,currency }) => {
5051

5152
<div className="price">
5253
<span className="price-amount">
54+
<sup>{getCurrencySymbol(currency)}</sup>
5355
{isYearly
5456
? formatPrice(x.yearlyprice)
5557
: formatPrice(x.monthlyprice)}
5658
</span>
57-
<span className="currency">{Currencies[currency]?.name ?? "USD" } </span>
59+
<span className="currency">{Currencies[currency]?.name ?? "USD"}</span>
5860
<span className="price-per">per user/year</span>
5961
</div>
6062

0 commit comments

Comments
 (0)