summaryrefslogtreecommitdiff
path: root/src-migrate/modules/footer-banner
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-06-21 11:01:35 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-06-21 11:01:35 +0700
commit220190db66bcc1c6db78180c593f21e9cf8f363c (patch)
tree1517faa9636a6b3b2cc8d468a57b1fe476c229d7 /src-migrate/modules/footer-banner
parent208b234320b6c42491a4e87a1c3db3abab9c1715 (diff)
parent1cf754b4d8da1aa28700ffc3dad67081f6daf9a5 (diff)
Merge branch 'promotion-program' into feature/all-promotion
Diffstat (limited to 'src-migrate/modules/footer-banner')
-rw-r--r--src-migrate/modules/footer-banner/index.tsx29
1 files changed, 29 insertions, 0 deletions
diff --git a/src-migrate/modules/footer-banner/index.tsx b/src-migrate/modules/footer-banner/index.tsx
new file mode 100644
index 00000000..7db1363c
--- /dev/null
+++ b/src-migrate/modules/footer-banner/index.tsx
@@ -0,0 +1,29 @@
+import Link from "next/link"
+import { useQuery } from "react-query"
+import Image from "~/components/ui/image"
+import { getBanner } from "~/services/banner"
+
+const FooterBanner = () => {
+ const fetchFooterBanner = useQuery({
+ queryKey: 'footerBanner',
+ queryFn: () => getBanner({ type: 'bottom-search-promotion' })
+ })
+
+ const banner = fetchFooterBanner?.data?.[0] || false
+
+ return banner && (
+ <>
+ {banner.url && (
+ <Link href={banner.url}>
+ <Image src={banner.image} alt={banner.name} width={924} height={150} className='object-cover object-center rounded-lg' />
+ </Link>
+ )}
+
+ {!banner.url && (
+ <Image src={banner.image} alt={banner.name} width={924} height={150} className='object-cover object-center rounded-lg' />
+ )}
+ </>
+ )
+}
+
+export default FooterBanner \ No newline at end of file