diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-02 17:15:39 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-02 17:15:39 +0700 |
| commit | 55c9f5e1fb868c85e704529ac914b3d75fc7744e (patch) | |
| tree | 75543baf82a73fb7e8dea6c8a1c353e02c57bbcd /src/core/components/elements/Navbar/TopBanner.jsx | |
| parent | d57ca7be5e2de9c48f4229b20a49a94bf05e88d1 (diff) | |
| parent | 6a2c25e83a45eeb5d613a99a0caa6f0ec1aae15f (diff) | |
<iman> Merge branch 'development' into Feature/new-cart-popup
Diffstat (limited to 'src/core/components/elements/Navbar/TopBanner.jsx')
| -rw-r--r-- | src/core/components/elements/Navbar/TopBanner.jsx | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/core/components/elements/Navbar/TopBanner.jsx b/src/core/components/elements/Navbar/TopBanner.jsx index 722a7501..df47e87d 100644 --- a/src/core/components/elements/Navbar/TopBanner.jsx +++ b/src/core/components/elements/Navbar/TopBanner.jsx @@ -1,39 +1,40 @@ import Image from 'next/image'; -import { useQuery } from 'react-query'; - +import { useQuery } from 'react-query';import useDevice from '@/core/hooks/useDevice' import odooApi from '@/core/api/odooApi'; import SmoothRender from '~/components/ui/smooth-render'; import Link from '../Link/Link'; +import { background } from '@chakra-ui/react'; const TopBanner = () => { + const { isDesktop, isMobile } = useDevice() const topBanner = useQuery({ queryKey: 'topBanner', queryFn: async () => await odooApi('GET', '/api/v1/banner?type=top-banner'), refetchOnWindowFocus: false, }); - const backgroundColor = topBanner.data?.[0]?.backgroundColor || 'transparent'; + // const backgroundColor = topBanner.data?.[0]?.backgroundColor || 'transparent'; const hasData = topBanner.data?.length > 0; const data = topBanner.data?.[0] || null; return ( <SmoothRender isLoaded={hasData} - height='36px' + // height='36px' duration='700ms' delay='300ms' - style={{ backgroundColor }} - > - <Link href={data?.url}> - <Image - src={data?.image} - alt={data?.name} - width={1440} - height={40} - className='object-cover object-center h-full mx-auto' - /> - </Link> - </SmoothRender> + className='h-auto' + > + <Link + href={data?.url} + className="block bg-cover bg-center h-3 md:h-6 lg:h-[36px]" + style={{ + backgroundImage: `url('${data?.image}')`, + }} + > + </Link> + + </SmoothRender> ); }; |
