|
@@ -1,4 +1,4 @@
|
|
|
-import { memo } from 'react';
|
|
|
|
|
|
|
+import { memo, useRef } from 'react';
|
|
|
|
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
@@ -9,11 +9,13 @@ import PayMethodCard from './components/PayMethodCard';
|
|
|
import PlanCard from './components/PlanCard';
|
|
import PlanCard from './components/PlanCard';
|
|
|
import UserInfo from './components/UserInfo';
|
|
import UserInfo from './components/UserInfo';
|
|
|
import { useAction } from './useAction';
|
|
import { useAction } from './useAction';
|
|
|
|
|
+import { usePlanCardsHeightSync } from './usePlanCardsHeightSync';
|
|
|
import { useService } from './useService';
|
|
import { useService } from './useService';
|
|
|
|
|
|
|
|
const Pricing = memo(() => {
|
|
const Pricing = memo(() => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
const { isMobile } = useResponsive();
|
|
const { isMobile } = useResponsive();
|
|
|
|
|
+ const planCardsContainerRef = useRef<HTMLDivElement>(null);
|
|
|
const { selectedPlanId, handlePlanClick, selectedPayMethod, handlePayMethodClick } =
|
|
const { selectedPlanId, handlePlanClick, selectedPayMethod, handlePayMethodClick } =
|
|
|
useAction();
|
|
useAction();
|
|
|
|
|
|
|
@@ -21,6 +23,8 @@ const Pricing = memo(() => {
|
|
|
|
|
|
|
|
const selectedPlan = plans.find((plan) => plan.id === selectedPlanId) || null;
|
|
const selectedPlan = plans.find((plan) => plan.id === selectedPlanId) || null;
|
|
|
|
|
|
|
|
|
|
+ usePlanCardsHeightSync(planCardsContainerRef, isMobile, plans.length);
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className="flex items-start justify-center">
|
|
<div className="flex items-start justify-center">
|
|
|
<div className={`max-w-[1440px] w-full ${isMobile ? 'px-0' : 'px-[30px]'}`}>
|
|
<div className={`max-w-[1440px] w-full ${isMobile ? 'px-0' : 'px-[30px]'}`}>
|
|
@@ -40,10 +44,11 @@ const Pricing = memo(() => {
|
|
|
{t('pages.pricing.selecPlan')}
|
|
{t('pages.pricing.selecPlan')}
|
|
|
</span>
|
|
</span>
|
|
|
<div
|
|
<div
|
|
|
|
|
+ ref={planCardsContainerRef}
|
|
|
className={
|
|
className={
|
|
|
isMobile
|
|
isMobile
|
|
|
? 'flex-col-c gap-5'
|
|
? 'flex-col-c gap-5'
|
|
|
- : 'flex flex-wrap justify-start gap-x-8 gap-y-4 [&>*]:flex-[1_1_calc(25%-1.5rem)]'
|
|
|
|
|
|
|
+ : 'flex flex-wrap justify-start gap-x-8 gap-y-4 [&>*]:flex-[1_1_calc(25%-1.5rem)] [&>*]:max-w-[calc(25%-1.5rem)]'
|
|
|
}
|
|
}
|
|
|
>
|
|
>
|
|
|
{plans.map((plan) => (
|
|
{plans.map((plan) => (
|
|
@@ -61,7 +66,7 @@ const Pricing = memo(() => {
|
|
|
))}
|
|
))}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div className="flex flex-col gap-5">
|
|
|
|
|
|
|
+ <div className="flex flex-col gap-4 mt-1">
|
|
|
<span
|
|
<span
|
|
|
className={`text-white font-semibold leading-[1.43] ${isMobile ? 'text-[16px]' : 'text-[22px]'}`}
|
|
className={`text-white font-semibold leading-[1.43] ${isMobile ? 'text-[16px]' : 'text-[22px]'}`}
|
|
|
>
|
|
>
|
|
@@ -70,8 +75,8 @@ const Pricing = memo(() => {
|
|
|
<div
|
|
<div
|
|
|
className={
|
|
className={
|
|
|
isMobile
|
|
isMobile
|
|
|
- ? 'flex-col-c gap-5'
|
|
|
|
|
- : 'flex flex-wrap justify-start gap-x-8 gap-y-4 [&>*]:flex-[1_1_calc(50%-1rem)]'
|
|
|
|
|
|
|
+ ? 'flex-col-c gap-4'
|
|
|
|
|
+ : 'flex flex-wrap justify-start gap-x-8 gap-y-4 [&>*]:flex-[1_1_calc(50%-1rem)] [&>*]:max-w-[calc(50%-1rem)]'
|
|
|
}
|
|
}
|
|
|
>
|
|
>
|
|
|
{payMethods.map((payMethod) => (
|
|
{payMethods.map((payMethod) => (
|