index.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { memo } from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { useResponsive } from '@/hooks/useResponsive';
  4. import PlanCard from '../PlanCard';
  5. import OrderSummary from '../OrderSummary';
  6. import { useAction } from './useAction';
  7. import { useService } from './useService';
  8. import UserInfo from '../UserInfo';
  9. const PricingContent = memo(() => {
  10. const { t } = useTranslation();
  11. const { isMobile } = useResponsive();
  12. const { selectedPlanId, handlePlanClick } = useAction();
  13. const { plans } = useService();
  14. const selectedPlan = plans.find((plan) => plan.id === selectedPlanId) || null;
  15. return (
  16. <div className="max-w-[1440px] w-full px-[30px]">
  17. <div className={`bg-[#0F1116] px-5 sm:px-6 lg:px-[100px] py-[30px] pb-[100px] my-[50px] rounded-[12px] flex flex-col gap-10 ${isMobile ? 'gap-5' : 'gap-10'}`}>
  18. <span
  19. className={`text-white font-semibold leading-[1.43] text-center uppercase ${isMobile ? 'text-[22px]' : 'text-[35px]'}`}
  20. >
  21. {t('pages.pricing.title')}
  22. </span>
  23. <UserInfo />
  24. <span
  25. className={`text-white font-semibold leading-[1.43] uppercase ${isMobile ? 'text-[16px]' : 'text-[22px]'}`}
  26. >
  27. {t('pages.pricing.subTitle')}
  28. </span>
  29. <div className="flex flex-col gap-10">
  30. <div
  31. className={`flex ${
  32. isMobile
  33. ? 'flex-col items-center'
  34. : 'flex-row items-center justify-center'
  35. } gap-8`}
  36. >
  37. {plans.map((plan) => (
  38. <PlanCard
  39. key={plan.id}
  40. id={plan.id}
  41. title={plan.title}
  42. subTitle={plan.subTitle}
  43. introduce={plan.introduce}
  44. tag={plan.tag}
  45. tagType={plan.tagType}
  46. isSelected={selectedPlanId === plan.id}
  47. onClick={() => handlePlanClick(plan.id)}
  48. />
  49. ))}
  50. </div>
  51. </div>
  52. <OrderSummary selectedPlan={selectedPlan} />
  53. </div>
  54. </div>
  55. );
  56. });
  57. PricingContent.displayName = 'PricingContent';
  58. export default PricingContent;