summaryrefslogtreecommitdiff
path: root/src-migrate/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src-migrate/modules')
-rw-r--r--src-migrate/modules/footer-banner/index.tsx29
-rw-r--r--src-migrate/modules/side-banner/index.tsx29
2 files changed, 58 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
diff --git a/src-migrate/modules/side-banner/index.tsx b/src-migrate/modules/side-banner/index.tsx
new file mode 100644
index 00000000..be52c554
--- /dev/null
+++ b/src-migrate/modules/side-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 SideBanner = () => {
+ const fetchSideBanner = useQuery({
+ queryKey: 'sideBanner',
+ queryFn: () => getBanner({ type: 'side-banner-search' })
+ })
+
+ const banner = fetchSideBanner?.data?.[0] || false
+
+ return banner && (
+ <>
+ {banner.url && (
+ <Link href={banner.url}>
+ <Image src={banner.image} alt={banner.name} width={315} height={450} className='object-cover object-center rounded-lg' />
+ </Link>
+ )}
+
+ {!banner.url && (
+ <Image src={banner.image} alt={banner.name} width={315} height={450} className='object-cover object-center rounded-lg' />
+ )}
+ </>
+ )
+}
+
+export default SideBanner \ No newline at end of file