From fbdcd34fc1dd5fce8c56c972e4f0658661435459 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Tue, 1 Oct 2024 13:55:00 +0700
Subject: optimize banner

---
 src/components/ui/HeroBannerSecondary.jsx | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'src/components/ui/HeroBannerSecondary.jsx')

diff --git a/src/components/ui/HeroBannerSecondary.jsx b/src/components/ui/HeroBannerSecondary.jsx
index b1023990..a7b32a4a 100644
--- a/src/components/ui/HeroBannerSecondary.jsx
+++ b/src/components/ui/HeroBannerSecondary.jsx
@@ -18,18 +18,22 @@ const HeroBannerSecondary = () => {
   if (heroBannerSecondary.isLoading) return <HeroBannerSkeleton />
 
   return (
-    heroBannerSecondary.data && (
-      <Link href={heroBannerSecondary.data[randomIndex].url} className='h-full'>
+    heroBannerSecondary.data && randomIndex !== null && (
+      <Link href={heroBannerSecondary.data[randomIndex].url} className="h-full">
         <Image
           src={heroBannerSecondary.data[randomIndex].image}
           width={512}
           height={1024}
           alt={heroBannerSecondary.data[randomIndex].name}
-          className='object-cover object-center h-full'
+          className="object-cover object-center h-full"
+          loading="lazy" 
+          placeholder="blur" 
+          blurDataURL="/images/indoteknik-placeholder.png" 
+          sizes="(max-width: 768px) 100vw, 50vw" 
         />
       </Link>
     )
-  )
+  );
 }
 
 export default HeroBannerSecondary
-- 
cgit v1.2.3

