From 3701899613c02e547fecebf62f7105860d1a2b72 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Fri, 28 Apr 2023 15:57:13 +0700
Subject: product similar product detail and top banner

---
 src/core/components/elements/Navbar/TopBanner.jsx | 25 +++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 src/core/components/elements/Navbar/TopBanner.jsx

(limited to 'src/core/components/elements/Navbar/TopBanner.jsx')

diff --git a/src/core/components/elements/Navbar/TopBanner.jsx b/src/core/components/elements/Navbar/TopBanner.jsx
new file mode 100644
index 00000000..69c2ab05
--- /dev/null
+++ b/src/core/components/elements/Navbar/TopBanner.jsx
@@ -0,0 +1,25 @@
+import odooApi from '@/core/api/odooApi'
+import { useQuery } from 'react-query'
+import Image from 'next/image'
+
+const TopBanner = () => {
+  const fetchTopBanner = async () => await odooApi('GET', '/api/v1/banner?type=top-banner')
+  const topBanner = useQuery('topBanner', fetchTopBanner)
+
+  return (
+    topBanner.isFetched &&
+    topBanner.data?.length > 0 && (
+      <div>
+        <Image
+          src={topBanner.data[0].image}
+          alt={topBanner.data[0].name}
+          width={1440}
+          height={40}
+          className='object-cover object-center h-full mx-auto'
+        />
+      </div>
+    )
+  )
+}
+
+export default TopBanner
-- 
cgit v1.2.3


From df778246733eb29ead71f89cfc36e706a74a15b0 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Fri, 28 Apr 2023 16:28:19 +0700
Subject: add background color in topbar

---
 src/core/components/elements/Navbar/TopBanner.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/core/components/elements/Navbar/TopBanner.jsx')

diff --git a/src/core/components/elements/Navbar/TopBanner.jsx b/src/core/components/elements/Navbar/TopBanner.jsx
index 69c2ab05..48b23a3d 100644
--- a/src/core/components/elements/Navbar/TopBanner.jsx
+++ b/src/core/components/elements/Navbar/TopBanner.jsx
@@ -9,7 +9,7 @@ const TopBanner = () => {
   return (
     topBanner.isFetched &&
     topBanner.data?.length > 0 && (
-      <div>
+      <div style={{ backgroundColor: topBanner.data[0]?.backgroundColor || 'transparent' }}>
         <Image
           src={topBanner.data[0].image}
           alt={topBanner.data[0].name}
-- 
cgit v1.2.3

