blob: c6737037c306e10bb644a5ca2f81d06a23f4592b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
import dynamic from 'next/dynamic'
import Seo from '@/core/components/Seo'
import ImageSkeleton from '@/core/components/elements/Skeleton/ImageSkeleton'
import PopularProductSkeleton from '@/lib/home/components/Skeleton/PopularProductSkeleton'
import MobileView from '@/core/components/views/MobileView'
import DesktopView from '@/core/components/views/DesktopView'
import { useRef } from 'react'
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() {
const bannerRef = useRef(null)
const wrapperRef = useRef(null)
const handleOnLoad = () => {
wrapperRef.current.style.height =
bannerRef.current.querySelector(':first-child').clientHeight + 'px'
}
return (
<BasicLayout>
<Seo title='Beranda - Indoteknik' />
<DesktopView>
<div className='container mx-auto'>
<div
className='flex h-[360px]'
ref={wrapperRef}
onLoad={handleOnLoad}
>
<div className='w-3/12'></div>
<div
className='w-6/12 px-1'
ref={bannerRef}
>
<HeroBanner />
</div>
<div className='w-3/12'>
<PopularProduct />
</div>
</div>
<div className='my-16 flex flex-col gap-y-10'>
<PreferredBrand />
<CategoryHomeId />
</div>
</div>
</DesktopView>
<MobileView>
<HeroBanner />
<div className='flex flex-col gap-y-6 my-6'>
<PreferredBrand />
<PopularProduct />
<CategoryHomeId />
</div>
</MobileView>
</BasicLayout>
)
}
|