diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-06-28 03:26:38 +0000 |
|---|---|---|
| committer | trisusilo <tri.susilo@altama.co.id> | 2024-06-28 03:26:38 +0000 |
| commit | def7fc2f1201286c44545e1305ca9f11eb16f3d0 (patch) | |
| tree | 4c65db77b9aa28f3dd53ce514de9d918440c2887 /src-migrate/modules/product-promo/components/AddToCart.tsx | |
| parent | 98d4f9564bfba66687848b335026bddb6f4dc5b6 (diff) | |
| parent | 936f7f9fb1c6951e02dd8a5f7e85fb8d39cc7e6a (diff) | |
Merged in promotion-program (pull request #140)
Promotion program
Approved-by: trisusilo
Diffstat (limited to 'src-migrate/modules/product-promo/components/AddToCart.tsx')
| -rw-r--r-- | src-migrate/modules/product-promo/components/AddToCart.tsx | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/src-migrate/modules/product-promo/components/AddToCart.tsx b/src-migrate/modules/product-promo/components/AddToCart.tsx index 192dd231..87017c14 100644 --- a/src-migrate/modules/product-promo/components/AddToCart.tsx +++ b/src-migrate/modules/product-promo/components/AddToCart.tsx @@ -7,6 +7,9 @@ import { getAuth } from '~/libs/auth' import { upsertUserCart } from '~/services/cart' import { IPromotion } from '~/types/promotion' +import DesktopView from '../../../../src/core/components/views/DesktopView'; +import MobileView from '../../../../src/core/components/views/MobileView'; + type Props = { promotion: IPromotion } @@ -55,21 +58,42 @@ const ProductPromoAddToCart = ({ promotion }: Props) => { }, [status]) return ( - <Button - colorScheme='yellow' - px={2} - w='110px' - gap={1} - isDisabled={status === 'loading'} - onClick={handleButton} - > - {status === 'success' && <CheckIcon size={16} />} - {status === 'loading' && <Spinner size='xs' mr={1.5} />} - {status === 'idle' && <PlusIcon size={16} />} + <div> + <MobileView> + <Button + colorScheme='yellow' + px={2} + w='36px' + gap={1} + isDisabled={status === 'loading'} + onClick={handleButton} + > + {status === 'success' && <CheckIcon size={16} />} + {status === 'loading' && <Spinner size='xs' mr={1.5} />} + {status === 'idle' && <PlusIcon size={16} />} + + {status === 'success' && <span>Berhasil</span>} + {/* {status !== 'success' && <span>Keranjang</span>} */} + </Button> + </MobileView> + <DesktopView> + <Button + colorScheme='yellow' + px={2} + w='110px' + gap={1} + isDisabled={status === 'loading'} + onClick={handleButton} + > + {status === 'success' && <CheckIcon size={16} />} + {status === 'loading' && <Spinner size='xs' mr={1.5} />} + {status === 'idle' && <PlusIcon size={16} />} - {status === 'success' && <span>Berhasil</span>} - {status !== 'success' && <span>Keranjang</span>} - </Button> + {status === 'success' && <span>Berhasil</span>} + {status !== 'success' && <span>Keranjang</span>} + </Button> + </DesktopView> + </div> ) } |
