From 5c0f43f53f330387cc86afd51beaeebf4069cad9 Mon Sep 17 00:00:00 2001
From: Miqdad <ahmadmiqdad27@gmail.com>
Date: Sat, 23 Aug 2025 10:06:10 +0700
Subject: <Miqdad> variant

---
 .../product-detail/components/AddToCart.tsx        | 23 ++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

(limited to 'src-migrate/modules/product-detail/components/AddToCart.tsx')

diff --git a/src-migrate/modules/product-detail/components/AddToCart.tsx b/src-migrate/modules/product-detail/components/AddToCart.tsx
index 95bc1d88..9f66345e 100644
--- a/src-migrate/modules/product-detail/components/AddToCart.tsx
+++ b/src-migrate/modules/product-detail/components/AddToCart.tsx
@@ -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,17 +163,30 @@ const AddToCart = ({
 
   const btnConfig = {
     add_to_cart: {
-      colorScheme: 'yellow',
+      colorScheme: isDesktop ? 'yellow' : 'red',
+      variant: 'solid',
       text: 'Keranjang',
     },
     buy: {
       colorScheme: 'red',
-      text: 'Beli',
+      variant: isDesktop ? 'solid' : 'outline',
+      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}
@@ -176,6 +194,7 @@ const AddToCart = ({
       >
         {btnConfig[source].text}
       </Button>
+      </DesktopView>
       <BottomPopup
         className='!container'
         title='Berhasil Ditambahkan'
-- 
cgit v1.2.3


From 37bda78dec58cb8c218849a77620d95682b201b9 Mon Sep 17 00:00:00 2001
From: Miqdad <ahmadmiqdad27@gmail.com>
Date: Tue, 26 Aug 2025 15:38:29 +0700
Subject: <Miqdad> Major Fix

---
 src-migrate/modules/product-detail/components/AddToCart.tsx | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'src-migrate/modules/product-detail/components/AddToCart.tsx')

diff --git a/src-migrate/modules/product-detail/components/AddToCart.tsx b/src-migrate/modules/product-detail/components/AddToCart.tsx
index 9f66345e..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';
@@ -163,13 +163,13 @@ const AddToCart = ({
 
   const btnConfig = {
     add_to_cart: {
-      colorScheme: isDesktop ? 'yellow' : 'red',
-      variant: 'solid',
+      colorScheme: 'red',
+      variant: 'outline',
       text: 'Keranjang',
     },
     buy: {
       colorScheme: 'red',
-      variant: isDesktop ? 'solid' : 'outline',
+      variant: 'solid',
       text: isDesktop ? 'Beli' : 'Beli Sekarang',
     },
   };
@@ -190,6 +190,7 @@ const AddToCart = ({
       <Button
         onClick={handleButton}
         colorScheme={btnConfig[source].colorScheme}
+        variant= {btnConfig[source].variant}
         className='w-full'
       >
         {btnConfig[source].text}
-- 
cgit v1.2.3

