From 62efd1afc02422545579c529cd954d0c157889ee Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Sat, 18 Mar 2023 10:17:16 +0700 Subject: navbar user dropdown, add to cart --- .../components/elements/Navbar/NavbarDesktop.jsx | 47 +++++++++++++++------- .../elements/Navbar/NavbarUserDropdown.jsx | 16 ++++++++ 2 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 src/core/components/elements/Navbar/NavbarUserDropdown.jsx (limited to 'src/core') diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx index fa620eb2..3ee9dc1e 100644 --- a/src/core/components/elements/Navbar/NavbarDesktop.jsx +++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx @@ -11,11 +11,14 @@ import dynamic from 'next/dynamic' import IndoteknikLogo from '@/images/logo.png' import Category from '@/lib/category/components/Category' import { useState } from 'react' +import useAuth from '@/core/hooks/useAuth' +import NavbarUserDropdown from './NavbarUserDropdown' const Search = dynamic(() => import('./Search')) const NavbarDesktop = () => { const [isOpenCategory, setIsOpenCategory] = useState(false) + const auth = useAuth() return ( @@ -82,7 +85,7 @@ const NavbarDesktop = () => { >
Kategori Produk
- +
@@ -113,19 +116,35 @@ const NavbarDesktop = () => { Blog Indoteknik -
- - Masuk - - - Daftar - + +
+ {!auth && ( + <> + + Masuk + + + Daftar + + + )} + {auth && ( + <> + + Halo, {auth?.name} +
+ +
+ + + + )}
diff --git a/src/core/components/elements/Navbar/NavbarUserDropdown.jsx b/src/core/components/elements/Navbar/NavbarUserDropdown.jsx new file mode 100644 index 00000000..fb95c593 --- /dev/null +++ b/src/core/components/elements/Navbar/NavbarUserDropdown.jsx @@ -0,0 +1,16 @@ +import Link from '../Link/Link' + +const NavbarUserDropdown = () => { + return ( +
+
+ Daftar Transaksi + Invoice & Faktur Pajak + Wishlist + Pengaturan Akun +
+
+ ) +} + +export default NavbarUserDropdown -- cgit v1.2.3