File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -95,8 +95,8 @@ module BlogCard = {
9595 {
9696 let className = "absolute top-0 h-full w-full object-cover"
9797 switch previewImg {
98- | Some (src ) => <img className src />
99- | None => <img className src = defaultPreviewImg />
98+ | Some (src ) => <img className src loading = { # "lazy" } />
99+ | None => <img className src = defaultPreviewImg loading = { # "lazy" } />
100100 }
101101 }
102102 </Link >
@@ -155,7 +155,7 @@ module FeatureCard = {
155155 let className = "absolute top-0 h-full w-full object-cover"
156156 switch previewImg {
157157 | Some (src ) => <img className src />
158- | None => <img className src = defaultPreviewImg />
158+ | None => <img className src = defaultPreviewImg loading = { #eager } />
159159 }
160160 }
161161 </Link >
Original file line number Diff line number Diff line change @@ -17,10 +17,14 @@ let simplifyUrl = url =>
1717
1818module LinkCard = {
1919 @react.component
20- let make = (~link ) => {
20+ let make = (~link , ~index ) => {
21+ let loading = switch index {
22+ | 0 => #eager
23+ | _ => # "lazy"
24+ }
2125 <div className = "rounded-lg hover:text-fire overflow-hidden bg-gray-10 border-2 border-gray-30" >
2226 <a href = link .url className = "flex flex-col h-full" >
23- <img className = "object-cover w-full lg:h-40 max-h-[345px]" src = link .image alt = "" />
27+ <img className = "object-cover w-full lg:h-40 max-h-[345px]" src = link .image alt = "" loading />
2428 <div className = "p-3 md:p-5 grow" >
2529 <h3 className = "font-semibold text-16 grow-0 mb-2" > {React .string (link .title )} </h3 >
2630 <p className = "mb-2 text-14 grow text-gray-80" > {React .string (link .description )} </p >
@@ -44,7 +48,7 @@ module LinkCards = {
4448 | _ => link
4549 }
4650 )
47- -> Array .map ( link => <LinkCard link key = link .title />)
51+ -> Array .mapWithIndex (( link , index ) => <LinkCard link key = link .title index />)
4852 -> React .array }
4953 </div >
5054 }
You can’t perform that action at this time.
0 commit comments