Skip to content

Commit 393dbb3

Browse files
committed
Plancard currency fix
Signed-off-by: Namanv509 <namanverma00260@gmail.com>
1 parent 1e996fb commit 393dbb3

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/components/Pricing/PlanCard/index.js

Lines changed: 10 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,13 @@ const PlanCard = ({ planData , isYearly ,currency }) => {
2017
};
2118

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

2729
return (
@@ -50,11 +52,12 @@ const PlanCard = ({ planData , isYearly ,currency }) => {
5052

5153
<div className="price">
5254
<span className="price-amount">
55+
<sup>{getCurrencySymbol(currency)}</sup>
5356
{isYearly
5457
? formatPrice(x.yearlyprice)
5558
: formatPrice(x.monthlyprice)}
5659
</span>
57-
<span className="currency">{Currencies[currency]?.name ?? "USD" } </span>
60+
<span className="currency">{Currencies[currency]?.name ?? "USD"}</span>
5861
<span className="price-per">per user/year</span>
5962
</div>
6063

0 commit comments

Comments
 (0)