index.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { memo } from 'react';
  2. import { Button } from 'antd';
  3. import { useTranslation } from 'react-i18next';
  4. import { useResponsive } from '@/hooks/useSize';
  5. import LabelValueItem from '../LabelValueItem';
  6. import type { Plan } from '../../useService';
  7. import { useService } from './useService';
  8. const PRICING_FORM_ID = 'pricing-form';
  9. export interface OrderSummaryProps {
  10. formId?: string;
  11. selectedPlan: Plan | null;
  12. selectedPayMethod: string | null;
  13. }
  14. const OrderSummary = memo(
  15. ({
  16. formId = PRICING_FORM_ID,
  17. selectedPlan,
  18. selectedPayMethod: _selectedPayMethod,
  19. }: OrderSummaryProps) => {
  20. const { t } = useTranslation();
  21. const { isMobile } = useResponsive();
  22. const { orderTotal } = useService({ selectedPlan });
  23. return (
  24. <div
  25. className={`flex flex-col bg-[#1B1D22] rounded-xl shadow-[0px_4px_10px_0px_rgba(0,0,0,0.05)] ${isMobile ? 'p-[14px] gap-2' : 'p-[25px_30px_25px_25px] gap-5'}`}
  26. >
  27. <div className={`flex flex-col ${isMobile ? 'gap-2' : 'gap-5'}`}>
  28. <LabelValueItem
  29. label={t('pages.pricing.orderSummary.orderTotal')}
  30. value={orderTotal}
  31. valueColor="text-[#0EA5E9]"
  32. />
  33. </div>
  34. <p className="text-[#646776] text-xs font-normal leading-[1.4]">
  35. {t('pages.pricing.orderSummary.terms')}
  36. </p>
  37. <div className={`flex gap-5 ${isMobile ? 'flex-col' : 'flex-row'}`}>
  38. <Button
  39. form={formId}
  40. htmlType="submit"
  41. className={`bg-[#0EA5E9] text-white text-sm font-medium leading-[1.4] uppercase rounded-[25px] px-[42px] py-[10px] h-auto border-none hover:bg-[#0EA5E9]/80 ${!isMobile ? 'w-[300px]' : ''}`}
  42. >
  43. {t('pages.pricing.orderSummary.goPayNow')}
  44. </Button>
  45. </div>
  46. </div>
  47. );
  48. }
  49. );
  50. OrderSummary.displayName = 'OrderSummary';
  51. export default OrderSummary;