summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/components/layouts/BasicLayout.jsx5
-rw-r--r--src/pages/_document.jsx5
-rw-r--r--src/pages/google_merchant/products/[page].js7
-rw-r--r--src/pages/shop/product/variant/[slug].jsx10
-rw-r--r--src/styles/globals.css44
5 files changed, 52 insertions, 19 deletions
diff --git a/src/core/components/layouts/BasicLayout.jsx b/src/core/components/layouts/BasicLayout.jsx
index e6bd4de0..9441dbd7 100644
--- a/src/core/components/layouts/BasicLayout.jsx
+++ b/src/core/components/layouts/BasicLayout.jsx
@@ -24,13 +24,12 @@ const BasicLayout = ({ children }) => {
const router = useRouter()
const { product } = useProductContext()
-
useEffect(() => {
- if (router.pathname === '/shop/product/[slug]') {
+ if (router.pathname === '/shop/product/[slug]' || router.pathname === '/shop/product/variant/[slug]') {
setPayloadWa({
name: product?.name,
manufacture: product?.manufacture.name,
- url: createSlug('/shop/product/', product?.name, product?.id, true)
+ url: process.env.NEXT_PUBLIC_SELF_HOST + router.asPath
})
setTemplateWA('product')
diff --git a/src/pages/_document.jsx b/src/pages/_document.jsx
index 5f3d2367..6cd99b08 100644
--- a/src/pages/_document.jsx
+++ b/src/pages/_document.jsx
@@ -5,7 +5,7 @@ export default function MyDocument() {
const env = process.env.NODE_ENV
return (
- <Html>
+ <Html style={{ fontFamily: `'Inter', sans-serif` }}>
<Head>
<link rel='icon' href='/favicon.ico' />
<link rel='manifest' href='/manifest.json' />
@@ -19,6 +19,7 @@ export default function MyDocument() {
<meta name='theme-color' content='#fff' />
<link rel='prefetch' href='/images/logo-indoteknik-gear.png' />
+ <link rel='preload' href='/fonts/Inter/inter.css' as='style' />
<meta name='facebook-domain-verification' content='328wmjs7hcnz74rwsqzxvq50rmbtm2' />
<Script
@@ -77,7 +78,7 @@ export default function MyDocument() {
strategy='beforeInteractive'
src='https://www.googletagmanager.com/gtag/js?id=AW-954540379'
/>
-
+
<Script
id='google-ads'
strategy='afterInteractive'
diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js
index eeda4347..d6309090 100644
--- a/src/pages/google_merchant/products/[page].js
+++ b/src/pages/google_merchant/products/[page].js
@@ -47,6 +47,13 @@ export async function getServerSideProps({ res, query }) {
'g:brand': { '#text': product.manufacture?.name || '' },
'g:price': { '#text': `${Math.round(product.lowestPrice.price * 1.11)} IDR` }
}
+
+ if (product.stockTotal == 0) {
+ item['g:custom_label_0'] = { '#text': 'Stok Tidak Tersedia' }
+ } else {
+ item['g:custom_label_1'] = { '#text': 'Stok Tersedia' }
+ }
+
if (product.lowestPrice.discountPercentage > 0) {
item['g:sale_price'] = {
'#text': `${Math.round(product.lowestPrice.priceDiscount * 1.11)} IDR`
diff --git a/src/pages/shop/product/variant/[slug].jsx b/src/pages/shop/product/variant/[slug].jsx
index d0790249..455b248b 100644
--- a/src/pages/shop/product/variant/[slug].jsx
+++ b/src/pages/shop/product/variant/[slug].jsx
@@ -7,6 +7,8 @@ import { useRouter } from 'next/router'
import cookie from 'cookie'
import variantApi from '@/lib/product/api/variantApi'
import axios from 'axios'
+import { useProductContext } from '@/contexts/ProductContext'
+import { useEffect } from 'react'
const BasicLayout = dynamic(() => import('@/core/components/layouts/BasicLayout'))
const Product = dynamic(() => import('@/lib/product/components/Product/Product'))
@@ -46,6 +48,14 @@ export async function getServerSideProps(context) {
export default function ProductDetail({ product }) {
const router = useRouter()
+ const { setProduct } = useProductContext()
+
+ useEffect(() => {
+ if (product) {
+ setProduct(product)
+ }
+ }, [product, setProduct])
+
if (!product) return <PageNotFound />
return (
diff --git a/src/styles/globals.css b/src/styles/globals.css
index 06ae7ca2..e3e0e48e 100644
--- a/src/styles/globals.css
+++ b/src/styles/globals.css
@@ -1,5 +1,3 @@
-@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');
-
@tailwind base;
@tailwind components;
@tailwind utilities;
@@ -14,7 +12,8 @@ body {
text-body-2
text-gray_r-12
bg-gray_r-1
- overflow-x-clip;
+ overflow-x-clip
+ antialiased;
}
#__next main {
@@ -114,8 +113,8 @@ button {
focus:border-danger-500;
}
- .form-input[type=file] {
- @apply py-2
+ .form-input[type='file'] {
+ @apply py-2;
}
.btn-yellow,
@@ -401,7 +400,7 @@ button {
w-full;
}
-.table-specification > table > thead > tr > th:last-child{
+.table-specification > table > thead > tr > th:last-child {
@apply w-3/12;
}
@@ -463,7 +462,7 @@ button {
.table-data {
@apply w-full
table-auto
- border-collapse;;
+ border-collapse;
}
.table-data thead tr {
@@ -632,12 +631,29 @@ button {
}
@keyframes shake {
- 0% { transform: translateX(0); }
- 10%, 90% { transform: translateX(-10px); }
- 20%, 80% { transform: translateX(10px); }
- 30%, 50%, 70% { transform: translateX(-10px); }
- 40%, 60% { transform: translateX(10px); }
- 100% { transform: translateX(0); }
+ 0% {
+ transform: translateX(0);
+ }
+ 10%,
+ 90% {
+ transform: translateX(-10px);
+ }
+ 20%,
+ 80% {
+ transform: translateX(10px);
+ }
+ 30%,
+ 50%,
+ 70% {
+ transform: translateX(-10px);
+ }
+ 40%,
+ 60% {
+ transform: translateX(10px);
+ }
+ 100% {
+ transform: translateX(0);
+ }
}
.blink-color-flash-sale {
@@ -656,4 +672,4 @@ button {
to {
@apply text-warning-500;
}
-} \ No newline at end of file
+}