index.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 { useAction } from './useAction';
  8. import { useService } from './useService';
  9. export interface OrderSummaryProps {
  10. selectedPlan: Plan | null;
  11. selectedPayMethod: string | null;
  12. }
  13. const OrderSummary = memo(({ selectedPlan, selectedPayMethod }: OrderSummaryProps) => {
  14. const { t } = useTranslation();
  15. const { isMobile } = useResponsive();
  16. const { orderTotal } = useService({ selectedPlan });
  17. const { handlePayNow } = useAction({ selectedPlan, selectedPayMethod });
  18. return (
  19. <div
  20. 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'}`}
  21. >
  22. <div className={`flex flex-col ${isMobile ? 'gap-2' : 'gap-5'}`}>
  23. <LabelValueItem
  24. label={t('pages.pricing.orderSummary.orderTotal')}
  25. value={orderTotal}
  26. valueColor="text-[#0EA5E9]"
  27. />
  28. </div>
  29. <p className="text-[#646776] text-xs font-normal leading-[1.4]">
  30. {t('pages.pricing.orderSummary.terms')}
  31. </p>
  32. <div className={`flex gap-5 ${isMobile ? 'flex-col' : 'flex-row'}`}>
  33. <Button
  34. 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]' : ''}`}
  35. onClick={handlePayNow}
  36. >
  37. {t('pages.pricing.orderSummary.goPayNow')}
  38. </Button>
  39. </div>
  40. </div>
  41. );
  42. });
  43. OrderSummary.displayName = 'OrderSummary';
  44. export default OrderSummary;