@@ -5,10 +5,7 @@ import PlanCardWrapper from "./planCard.style";
55import FeatureDetails from "./collapsible-details" ;
66import { 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