summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Header.js16
-rw-r--r--src/components/Link.js9
-rw-r--r--src/components/ProductCard.js2
3 files changed, 18 insertions, 9 deletions
diff --git a/src/components/Header.js b/src/components/Header.js
index a1780b3c..0a4449be 100644
--- a/src/components/Header.js
+++ b/src/components/Header.js
@@ -1,5 +1,5 @@
import Image from "next/image";
-import Link from "next/link";
+import Link from "./Link";
import ShoppingCartIcon from "../icons/shopping-cart.svg";
import SearchIcon from "../icons/search.svg";
import MenuIcon from "../icons/menu.svg";
@@ -47,33 +47,33 @@ export default function Header({ title }) {
<h1>Hi, {auth.name}</h1>
) : (
<>
- <Link href="/login" className="w-full py-2 btn-light">Masuk</Link>
- <Link href="/register" className="w-full py-2 btn-yellow">Daftar</Link>
+ <Link href="/login" onClick={closeMenu} className="w-full py-2 btn-light">Masuk</Link>
+ <Link href="/register" onClick={closeMenu} className="w-full py-2 btn-yellow">Daftar</Link>
</>
)}
</div>
<div className="flex flex-col">
{auth ? (
- <Link className="flex w-full font-normal text-gray-800 border-b border-gray-300 p-4 py-3" href="/shop/brands">
+ <Link className="flex w-full font-normal text-gray-800 border-b border-gray-300 p-4 py-3" href="/shop/brands" onClick={closeMenu}>
<span>Profil Saya</span>
<div className="ml-auto">
<ChevronRightIcon className="stroke-gray-700" />
</div>
</Link>
) : ''}
- <Link className="flex w-full font-normal text-gray-800 border-b border-gray-300 p-4 py-3" href="/shop/brands">
+ <Link className="flex w-full font-normal text-gray-800 border-b border-gray-300 p-4 py-3" href="/shop/brands" onClick={closeMenu}>
<span>Semua Brand</span>
<div className="ml-auto">
<ChevronRightIcon className="stroke-gray-700" />
</div>
</Link>
- <Link className="flex w-full font-normal text-gray-800 border-b border-gray-300 p-4 py-3" href="/blog">
+ <Link className="flex w-full font-normal text-gray-800 border-b border-gray-300 p-4 py-3" href="/blog" onClick={closeMenu}>
<span>Blog Indoteknik</span>
<div className="ml-auto">
<ChevronRightIcon className="stroke-gray-700" />
</div>
</Link>
- <button className="flex w-full font-normal text-gray-800 border-b border-gray-300 p-4 py-3">
+ <button className="flex w-full font-normal text-gray-800 border-b border-gray-300 p-4 py-3" onClick={closeMenu}>
<span>Kategori</span>
<div className="ml-auto">
<ChevronRightIcon className="stroke-gray-700" />
@@ -85,7 +85,7 @@ export default function Header({ title }) {
<div className="sticky-header">
<div className="flex justify-between items-center">
- <Link href="/">
+ <Link href="/" scroll={false}>
<Image src={Logo} alt="Logo Indoteknik" width={120} height={40} />
</Link>
<div className="flex gap-4">
diff --git a/src/components/Link.js b/src/components/Link.js
new file mode 100644
index 00000000..d354bb1b
--- /dev/null
+++ b/src/components/Link.js
@@ -0,0 +1,9 @@
+import NextLink from "next/link";
+
+export default function Link({ children, ...pageProps }) {
+ return (
+ <NextLink {...pageProps} scroll={false}>
+ {children}
+ </NextLink>
+ )
+} \ No newline at end of file
diff --git a/src/components/ProductCard.js b/src/components/ProductCard.js
index 063a5f6b..2299d931 100644
--- a/src/components/ProductCard.js
+++ b/src/components/ProductCard.js
@@ -1,4 +1,4 @@
-import Link from "next/link";
+import Link from "./Link";
import currencyFormat from "../helpers/currencyFormat";
import { createSlug } from "../helpers/slug";
import { LazyLoadImage } from "react-lazy-load-image-component";