From 16fed2e7d00252f5df3f9b5bdf0a5a2b2a094f76 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Tue, 8 Aug 2023 10:39:34 +0700
Subject: Improve home page performance

---
 .../components/Skeleton/PreferredBrandSkeleton.jsx | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

(limited to 'src/lib/home/components/Skeleton/PreferredBrandSkeleton.jsx')

diff --git a/src/lib/home/components/Skeleton/PreferredBrandSkeleton.jsx b/src/lib/home/components/Skeleton/PreferredBrandSkeleton.jsx
index 00589342..bd783053 100644
--- a/src/lib/home/components/Skeleton/PreferredBrandSkeleton.jsx
+++ b/src/lib/home/components/Skeleton/PreferredBrandSkeleton.jsx
@@ -1,12 +1,16 @@
-import BrandSkeleton from '@/core/components/elements/Skeleton/BrandSkeleton'
+import useDevice from '@/core/hooks/useDevice'
+import Skeleton from 'react-loading-skeleton'
 
-const PreferredBrandSkeleton = () => (
-  <div className='grid grid-cols-4 gap-x-3'>
-    <BrandSkeleton />
-    <BrandSkeleton />
-    <BrandSkeleton />
-    <BrandSkeleton />
-  </div>
-)
+const PreferredBrandSkeleton = () => {
+  const { isDesktop } = useDevice()
+
+  return (
+    <div className='grid grid-cols-4 md:grid-cols-8 gap-x-3'>
+      {Array.from({ length: isDesktop ? 8 : 4 }, (_, index) => (
+        <Skeleton count={1} height={isDesktop ? 84 : 56} key={index} />
+      ))}
+    </div>
+  )
+}
 
 export default PreferredBrandSkeleton
-- 
cgit v1.2.3

