1- import { Box , Container } from '@mui/material' ;
2-
3- import CallToActionSection from '@/components/Home/CallToActionSection' ;
4- import CommunitySection from '@/components/Home/CommunitySection' ;
5- import FeaturesAtGlanceSection from '@/components/Home/FeaturesAtGlanceSection' ;
6- import Footer from '@/components/Home/Footer' ;
1+ import { Box , Container , Skeleton } from '@mui/material' ;
2+ import React , { lazy , Suspense } from 'react' ;
73
84// import SponsorsSection from '@/components/Home/SponsorsSection';
95// import TestimonialSection from '@/components/Home/TestimonialSection';
10- import FeaturesAndBenefitsSection from '../components/Home/FeaturesAndBenefitsSection' ;
116import HeroSection from '../components/Home/HeroSection' ;
12- import ProjectSection from '../components/Home/ProjectSection' ;
7+
8+ const CallToActionSection = lazy ( ( ) => import ( '@/components/Home/CallToActionSection' ) ) ;
9+ const CommunitySection = lazy ( ( ) => import ( '@/components/Home/CommunitySection' ) ) ;
10+ const FeaturesAtGlanceSection = lazy ( ( ) => import ( '@/components/Home/FeaturesAtGlanceSection' ) ) ;
11+ const FeaturesAndBenefitsSection = lazy ( ( ) => import ( '../components/Home/FeaturesAndBenefitsSection' ) ) ;
12+ const ProjectSection = lazy ( ( ) => import ( '../components/Home/ProjectSection' ) ) ;
13+ const Footer = lazy ( ( ) => import ( '@/components/Home/Footer' ) ) ;
1314
1415/**
1516 * Landing page that users first see upon visiting the website.
@@ -24,39 +25,42 @@ const Home: React.FC = () => {
2425 px : { sm : '10%' , xs : 0 } ,
2526 } }
2627 >
27- < Container
28- maxWidth = { false }
29- disableGutters
30- sx = { {
31- px : { sm : 6 , xs : 2 } ,
32- } }
33- >
28+ < Container maxWidth = { false } disableGutters sx = { { px : { sm : 6 , xs : 2 } } } >
3429 < HeroSection />
30+
31+ { /* spacer */ }
3532 < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
36- < FeaturesAtGlanceSection />
37- < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
38- < FeaturesAndBenefitsSection />
39- < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
40- < ProjectSection />
41- < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
42- < CommunitySection />
43- < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
44- { /* <TestimonialSection />
45- <Box sx={{ height: { sm: '240px', xs: '64px' } }} />
46- <SponsorsSection />
47- <Box sx={{ height: { sm: '240px', xs: '64px' } }} /> */ }
48- < CallToActionSection />
49- < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
33+
34+ { /* single Suspense for all lazy sections */ }
35+ < Suspense fallback = { < Skeleton variant = "rectangular" height = { 240 } animation = "wave" sx = { { mb : 4 } } /> } >
36+ < FeaturesAtGlanceSection />
37+ < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
38+
39+ < FeaturesAndBenefitsSection />
40+ < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
41+
42+ < ProjectSection />
43+ < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
44+
45+ < CommunitySection />
46+ < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
47+
48+ < CallToActionSection />
49+ < Box sx = { { height : { sm : '240px' , xs : '64px' } } } />
50+ </ Suspense >
5051 </ Container >
5152 </ Box >
53+
5254 < Box
5355 sx = { {
5456 backgroundColor : 'background.paper' ,
5557 color : 'text.primary' ,
5658 px : { sm : '48px' , xs : 0 } ,
5759 } }
5860 >
59- < Footer />
61+ < Suspense fallback = { < Skeleton variant = "rectangular" height = { 200 } /> } >
62+ < Footer />
63+ </ Suspense >
6064 </ Box >
6165 </ >
6266 ) ;
0 commit comments