summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/components/elements/Image/Image.jsx16
-rw-r--r--src/core/components/elements/Navbar/Navbar.jsx4
-rw-r--r--src/core/components/elements/Sidebar/Sidebar.jsx8
-rw-r--r--src/core/utils/address.js31
4 files changed, 46 insertions, 13 deletions
diff --git a/src/core/components/elements/Image/Image.jsx b/src/core/components/elements/Image/Image.jsx
index 579660a4..a6f0b00c 100644
--- a/src/core/components/elements/Image/Image.jsx
+++ b/src/core/components/elements/Image/Image.jsx
@@ -2,13 +2,15 @@ import { LazyLoadImage } from "react-lazy-load-image-component"
import "react-lazy-load-image-component/src/effects/opacity.css"
const Image = ({ ...props }) => (
- <LazyLoadImage
- { ...props }
- src={props.src || '/images/noimage.jpeg'}
- placeholderSrc="/images/indoteknik-placeholder.png"
- alt={props.src ? props.alt : 'Image Not Found - Indoteknik'}
- wrapperClassName="bg-white"
- />
+ <>
+ <LazyLoadImage
+ { ...props }
+ src={props.src || '/images/noimage.jpeg'}
+ placeholderSrc="/images/indoteknik-placeholder.png"
+ alt={props.src ? props.alt : 'Image Not Found - Indoteknik'}
+ wrapperClassName="bg-white"
+ />
+ </>
)
Image.defaultProps = LazyLoadImage.defaultProps
diff --git a/src/core/components/elements/Navbar/Navbar.jsx b/src/core/components/elements/Navbar/Navbar.jsx
index 99fdc446..f10ebd63 100644
--- a/src/core/components/elements/Navbar/Navbar.jsx
+++ b/src/core/components/elements/Navbar/Navbar.jsx
@@ -17,9 +17,9 @@ const Navbar = () => {
<Image src={IndoteknikLogo} alt="Indoteknik Logo" width={120} height={40} />
</Link>
<div className="flex gap-x-3">
- <button type="button">
+ <Link href="/my/wishlist">
<HeartIcon className="w-6 text-gray_r-12" />
- </button>
+ </Link>
<Link href="/shop/cart">
<ShoppingCartIcon className="w-6 text-gray_r-12" />
</Link>
diff --git a/src/core/components/elements/Sidebar/Sidebar.jsx b/src/core/components/elements/Sidebar/Sidebar.jsx
index 88de1c1c..48ceacf6 100644
--- a/src/core/components/elements/Sidebar/Sidebar.jsx
+++ b/src/core/components/elements/Sidebar/Sidebar.jsx
@@ -1,8 +1,8 @@
import Link from "../Link/Link"
import greeting from "@/core/utils/greeting"
-import { Cog6ToothIcon } from "@heroicons/react/24/solid"
import useAuth from "@/core/hooks/useAuth"
import { AnimatePresence, motion } from "framer-motion"
+import { CogIcon } from "@heroicons/react/24/outline"
const Sidebar = ({
active,
@@ -44,8 +44,8 @@ const Sidebar = ({
<div className="p-4 flex gap-x-3">
{ !auth && (
<>
- <Link href="/register" className="btn-yellow !text-gray_r-12 py-2 flex-1">Daftar</Link>
- <Link href="/login" className="btn-solid-red !text-gray_r-1 py-2 flex-1">Masuk</Link>
+ <Link onClick={close} href="/register" className="btn-yellow !text-gray_r-12 py-2 flex-1">Daftar</Link>
+ <Link onClick={close} href="/login" className="btn-solid-red !text-gray_r-1 py-2 flex-1">Masuk</Link>
</>
) }
{ auth && (
@@ -61,7 +61,7 @@ const Sidebar = ({
href="/my/menu"
className="!text-gray_r-11 ml-auto my-auto"
>
- <Cog6ToothIcon className="w-6" />
+ <CogIcon className="w-6" />
</Link>
</>
) }
diff --git a/src/core/utils/address.js b/src/core/utils/address.js
new file mode 100644
index 00000000..b89dd924
--- /dev/null
+++ b/src/core/utils/address.js
@@ -0,0 +1,31 @@
+const getAddress = () => {
+ if (typeof window !== 'undefined') {
+ const address = localStorage.getItem('address')
+ if (address) return JSON.parse(address)
+ }
+ return {}
+}
+
+const setAddress = (address) => {
+ if (typeof window !== 'undefined') {
+ localStorage.setItem('address', JSON.stringify(address))
+ }
+ return
+}
+
+const getItemAddress = (key) => {
+ let address = getAddress()
+ return address[key]
+}
+
+const updateItemAddress = (key, value) => {
+ let address = getAddress()
+ address[key] = value
+ setAddress(address)
+ return
+}
+
+export {
+ getItemAddress,
+ updateItemAddress
+} \ No newline at end of file