summaryrefslogtreecommitdiff
path: root/src/core/components/elements/Navbar
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-08-09 10:47:44 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-08-09 10:47:44 +0700
commit407af81fb2d9ebdf3415fe7b34d08996ed7c80ec (patch)
tree675d0981a6259b814c3deb7bd053a85892fea53b /src/core/components/elements/Navbar
parent9595223471946520f5c156e24eceb577fae4c901 (diff)
parent863047e92834479ce8edb576b57b129c611821a8 (diff)
Merge branch 'master' into CR/flash_sale
# Conflicts: # src/lib/product/components/ProductCard.jsx
Diffstat (limited to 'src/core/components/elements/Navbar')
-rw-r--r--src/core/components/elements/Navbar/NavbarDesktop.jsx9
-rw-r--r--src/core/components/elements/Navbar/Search.jsx30
-rw-r--r--src/core/components/elements/Navbar/TopBanner.jsx5
3 files changed, 27 insertions, 17 deletions
diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx
index ea4b03ae..acd2d1ee 100644
--- a/src/core/components/elements/Navbar/NavbarDesktop.jsx
+++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx
@@ -14,14 +14,17 @@ import { useEffect, useState } from 'react'
import useAuth from '@/core/hooks/useAuth'
import NavbarUserDropdown from './NavbarUserDropdown'
import { getCountCart } from '@/core/utils/cart'
-import TopBanner from './TopBanner'
import whatsappUrl from '@/core/utils/whatsappUrl'
import { useRouter } from 'next/router'
import { getAuth } from '@/core/utils/auth'
import { createSlug, getIdFromSlug } from '@/core/utils/slug'
import productApi from '@/lib/product/api/productApi'
+import { TopBannerSkeleton } from '../Skeleton/TopBannerSkeleton'
const Search = dynamic(() => import('./Search'))
+const TopBanner = dynamic(() => import('./TopBanner'), {
+ loading: () => <TopBannerSkeleton />
+})
const NavbarDesktop = () => {
const [isOpenCategory, setIsOpenCategory] = useState(false)
@@ -162,8 +165,10 @@ const NavbarDesktop = () => {
Ready Stock
</Link>
<Link
- href='/blog'
+ href='https://blog.indoteknik.com/'
className='p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition'
+ target='_blank'
+ rel='noreferrer noopener'
>
Blog Indoteknik
</Link>
diff --git a/src/core/components/elements/Navbar/Search.jsx b/src/core/components/elements/Navbar/Search.jsx
index 47a9c235..f4a8ab3a 100644
--- a/src/core/components/elements/Navbar/Search.jsx
+++ b/src/core/components/elements/Navbar/Search.jsx
@@ -64,21 +64,21 @@ const Search = () => {
<MagnifyingGlassIcon className='w-6' />
</button>
- {suggestions.length > 0 && (
- <>
- <div className='absolute w-full top-[50px] rounded-b bg-gray_r-1 border border-gray_r-6 divide-y divide-gray_r-6 z-50'>
- {suggestions.map((suggestion, index) => (
- <Link
- href={`/shop/search?q=${suggestion.term}`}
- key={index}
- className='px-3 py-3 !text-gray_r-12 font-normal'
- >
- {suggestion.term}
- </Link>
- ))}
- </div>
- </>
- )}
+ <div
+ className={`absolute w-full top-[50px] rounded-b bg-gray_r-1 border border-gray_r-6 divide-y divide-gray_r-6 z-50 ${
+ suggestions.length > 0 ? 'block' : 'hidden'
+ }`}
+ >
+ {suggestions.map((suggestion, index) => (
+ <Link
+ href={`/shop/search?q=${suggestion.term}`}
+ key={index}
+ className='px-3 py-3 !text-gray_r-12 font-normal'
+ >
+ {suggestion.term}
+ </Link>
+ ))}
+ </div>
</form>
</>
)
diff --git a/src/core/components/elements/Navbar/TopBanner.jsx b/src/core/components/elements/Navbar/TopBanner.jsx
index 9efd0a8d..dca2e930 100644
--- a/src/core/components/elements/Navbar/TopBanner.jsx
+++ b/src/core/components/elements/Navbar/TopBanner.jsx
@@ -2,11 +2,16 @@ import odooApi from '@/core/api/odooApi'
import { useQuery } from 'react-query'
import Image from 'next/image'
import Link from '../Link/Link'
+import { TopBannerSkeleton } from '../Skeleton/TopBannerSkeleton'
const TopBanner = () => {
const fetchTopBanner = async () => await odooApi('GET', '/api/v1/banner?type=top-banner')
const topBanner = useQuery('topBanner', fetchTopBanner)
+ if (topBanner.isLoading) {
+ return <TopBannerSkeleton />
+ }
+
return (
topBanner.isFetched &&
topBanner.data?.length > 0 && (