@@ -3,26 +3,54 @@ import backgroundImage from "../../assets/hero-image-bg.png";
33
44import { Button } from "../../components/ui/button" ;
55import { FEATURES } from "../../constants/landing-page-config.jsx" ;
6+ import { Blurhash } from "react-blurhash" ;
7+ import { useEffect , useState } from "react" ;
68
79export const HomePage = ( ) => {
10+ const [ loaded , setLoaded ] = useState ( false ) ;
11+
12+ const HERO_BLURHASH = "LlI#fGM{tQn~O[NJnPR,_4V[kVae" ;
13+
14+ useEffect ( ( ) => {
15+ const img = new Image ( ) ;
16+ img . src = backgroundImage ;
17+ img . onload = ( ) => setLoaded ( true ) ;
18+ } , [ ] ) ;
19+
820 return (
921 < div >
1022 { /* Hero */ }
11- < div
12- className = "bg-surface h-[500px] md:h-[600px] lg:h-[712px] flex items-center"
13- style = { {
14- backgroundImage : `url(${ backgroundImage } )` ,
15- backgroundSize : "cover" ,
16- backgroundPosition : "center" ,
17- } }
18- >
19- < div className = "container mx-auto px-6 lg:px-[89px] pt-0 lg:pt-32" >
23+ < div className = "relative h-[500px] md:h-[600px] lg:h-[712px] flex items-center overflow-hidden" >
24+ { /* Blurhash sebagai placeholder */ }
25+ { ! loaded && (
26+ < div className = "absolute inset-0 w-full h-full" >
27+ < Blurhash
28+ hash = { HERO_BLURHASH }
29+ width = { "100%" }
30+ height = { "100%" }
31+ resolutionX = { 32 }
32+ resolutionY = { 32 }
33+ punch = { 1 }
34+ />
35+ </ div >
36+ ) }
37+
38+ { /* Background image utama */ }
39+ < div
40+ className = { `absolute inset-0 w-full h-full bg-center bg-cover transition-opacity duration-200 ${
41+ loaded ? "opacity-100" : "opacity-0"
42+ } `}
43+ style = { {
44+ backgroundImage : `url(${ backgroundImage } )` ,
45+ } }
46+ />
47+
48+ { /* Konten hero */ }
49+ < div className = "container relative mx-auto px-6 lg:px-[89px] pt-0 lg:pt-32 z-10" >
2050 < div className = "max-w-full lg:max-w-[665px] text-center lg:text-left" >
21- { /* Penyesuaian font H1 */ }
2251 < h1 className = "text-4xl md:text-5xl lg:text-6xl font-semibold text-text-invers" >
2352 Selamat Datang di Pak Tani!
2453 </ h1 >
25- { /* Penyesuaian font Paragraf */ }
2654 < p className = "text-base md:text-lg lg:text-xl text-text-invers mt-2" >
2755 Kelola dan pantau sistem irigasi pertanian Anda dengan mudah,
2856 langsung dari genggaman Anda.
@@ -55,9 +83,9 @@ export const HomePage = () => {
5583 </ p >
5684 </ div >
5785 < div className = "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 mt-12 lg:mt-[61px] gap-8 lg:gap-[58px]" >
58- { FEATURES . map ( ( feature , i ) => (
86+ { FEATURES . map ( ( feature ) => (
5987 < div
60- key = { i }
88+ key = { feature . title }
6189 className = "bg-white w-full h-auto rounded-[20px] px-6 py-10 lg:px-[38px] lg:pt-[59px] shadow-md flex justify-center"
6290 >
6391 < div className = "flex flex-col items-center gap-4 text-center" >
0 commit comments