From 69f55de26319e570ce0a8c4dbe8a29cb0d0b51c5 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Sat, 18 Feb 2023 22:03:55 +0700
Subject: optimization

---
 src/pages/index.jsx | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

(limited to 'src/pages/index.jsx')

diff --git a/src/pages/index.jsx b/src/pages/index.jsx
index 05c6520a..6503ac20 100644
--- a/src/pages/index.jsx
+++ b/src/pages/index.jsx
@@ -1,9 +1,25 @@
+import dynamic from "next/dynamic"
 import Seo from "@/core/components/Seo"
-import BasicLayout from "@/core/components/layouts/BasicLayout"
-import CategoryHomeId from "@/lib/home/components/CategoryHomeId"
-import HeroBanner from "@/lib/home/components/HeroBanner"
-import PopularProduct from "@/lib/home/components/PopularProduct"
-import PreferredBrand from "@/lib/home/components/PreferredBrand"
+import ImageSkeleton from "@/core/components/elements/Skeleton/ImageSkeleton"
+import PopularProductSkeleton from "@/lib/home/components/Skeleton/PopularProductSkeleton"
+
+const BasicLayout = dynamic(() => import("@/core/components/layouts/BasicLayout"))
+
+const HeroBanner = dynamic(() => import("@/lib/home/components/HeroBanner"), {
+  loading: <ImageSkeleton />
+})
+
+const PreferredBrand = dynamic(() => import("@/lib/home/components/PreferredBrand"), {
+  loading: <PopularProductSkeleton />
+})
+
+const PopularProduct = dynamic(() => import("@/lib/home/components/PopularProduct"), {
+  loading: <PopularProductSkeleton />
+})
+
+const CategoryHomeId = dynamic(() => import("@/lib/home/components/CategoryHomeId"), {
+  loading: <PopularProductSkeleton />
+})
 
 export default function Home() {
   return (
-- 
cgit v1.2.3

