diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2024-04-25 11:33:09 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2024-04-25 11:33:09 +0700 |
| commit | 59e4c1cf1b45497bc98cbc13c57e33e1a256a22e (patch) | |
| tree | 886dd8b6e13abd23f339ffa8da47525ddaccd23c /src-migrate/modules/footer-banner | |
| parent | d3426a5d63add6e17cfcd0aefb01882e77eb4735 (diff) | |
Add side and bottom banner on search
Diffstat (limited to 'src-migrate/modules/footer-banner')
| -rw-r--r-- | src-migrate/modules/footer-banner/index.tsx | 29 |
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 |
