summaryrefslogtreecommitdiff
path: root/src/core/components/elements/Navbar/TopBanner.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/components/elements/Navbar/TopBanner.jsx')
-rw-r--r--src/core/components/elements/Navbar/TopBanner.jsx25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/components/elements/Navbar/TopBanner.jsx b/src/core/components/elements/Navbar/TopBanner.jsx
new file mode 100644
index 00000000..48b23a3d
--- /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 style={{ backgroundColor: topBanner.data[0]?.backgroundColor || 'transparent' }}>
+ <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