diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2025-08-26 10:33:43 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2025-08-26 10:33:43 +0000 |
| commit | 0862e3a45411e5033b768ca43a56c8f27dee3b9b (patch) | |
| tree | 11d0d0a4b808bf938dfcc7e8c2d8fef21d052a9f /src-migrate/modules/product-detail/components/AddToCart.tsx | |
| parent | ae2827dbaf8b02480d997b7fd323159a57143af5 (diff) | |
| parent | 37bda78dec58cb8c218849a77620d95682b201b9 (diff) | |
Merged in cr/prod-detail (pull request #449)
Cr/prod detail
Diffstat (limited to 'src-migrate/modules/product-detail/components/AddToCart.tsx')
| -rw-r--r-- | src-migrate/modules/product-detail/components/AddToCart.tsx | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src-migrate/modules/product-detail/components/AddToCart.tsx b/src-migrate/modules/product-detail/components/AddToCart.tsx index 95bc1d88..1cb58a75 100644 --- a/src-migrate/modules/product-detail/components/AddToCart.tsx +++ b/src-migrate/modules/product-detail/components/AddToCart.tsx @@ -1,6 +1,6 @@ import BottomPopup from '@/core/components/elements/Popup/BottomPopup'; import style from '../styles/price-action.module.css'; -import { Button, Link, useToast } from '@chakra-ui/react'; +import { Button, color, Link, useToast } from '@chakra-ui/react'; import product from 'next-seo/lib/jsonld/product'; import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; @@ -17,6 +17,9 @@ import formatCurrency from '~/libs/formatCurrency'; import { useProductDetail } from '../stores/useProductDetail'; import { gtagAddToCart } from '@/core/utils/googleTag'; import axios from 'axios'; +import useDevice from '@/core/hooks/useDevice'; +import MobileView from '@/core/components/views/MobileView'; +import DesktopView from '@/core/components/views/DesktopView'; type Props = { variantId: number | null; quantity?: number; @@ -39,6 +42,8 @@ const AddToCart = ({ isClosable: true, }); + const { isMobile, isDesktop } = useDevice(); + const { askAdminUrl } = useProductDetail(); const [product, setProducts] = useState(products); @@ -158,24 +163,39 @@ const AddToCart = ({ const btnConfig = { add_to_cart: { - colorScheme: 'yellow', + colorScheme: 'red', + variant: 'outline', text: 'Keranjang', }, buy: { colorScheme: 'red', - text: 'Beli', + variant: 'solid', + text: isDesktop ? 'Beli' : 'Beli Sekarang', }, }; return ( <div className='w-full'> + <MobileView> + <Button + onClick={handleButton} + colorScheme={btnConfig[source].colorScheme} + variant= {btnConfig[source].variant} + className='w-full' + > + {btnConfig[source].text} + </Button> + </MobileView> + <DesktopView> <Button onClick={handleButton} colorScheme={btnConfig[source].colorScheme} + variant= {btnConfig[source].variant} className='w-full' > {btnConfig[source].text} </Button> + </DesktopView> <BottomPopup className='!container' title='Berhasil Ditambahkan' |
