File tree 2 files changed +10
-6
lines changed
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -95,8 +95,8 @@ module BlogCard = {
95
95
{
96
96
let className = "absolute top-0 h-full w-full object-cover"
97
97
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" } />
100
100
}
101
101
}
102
102
</Link >
@@ -155,7 +155,7 @@ module FeatureCard = {
155
155
let className = "absolute top-0 h-full w-full object-cover"
156
156
switch previewImg {
157
157
| Some (src ) => <img className src />
158
- | None => <img className src = defaultPreviewImg />
158
+ | None => <img className src = defaultPreviewImg loading = { #eager } />
159
159
}
160
160
}
161
161
</Link >
Original file line number Diff line number Diff line change @@ -17,10 +17,14 @@ let simplifyUrl = url =>
17
17
18
18
module LinkCard = {
19
19
@react.component
20
- let make = (~link ) => {
20
+ let make = (~link , ~index ) => {
21
+ let loading = switch index {
22
+ | 0 => #eager
23
+ | _ => # "lazy"
24
+ }
21
25
<div className = "rounded-lg hover:text-fire overflow-hidden bg-gray-10 border-2 border-gray-30" >
22
26
<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 />
24
28
<div className = "p-3 md:p-5 grow" >
25
29
<h3 className = "font-semibold text-16 grow-0 mb-2" > {React .string (link .title )} </h3 >
26
30
<p className = "mb-2 text-14 grow text-gray-80" > {React .string (link .description )} </p >
@@ -44,7 +48,7 @@ module LinkCards = {
44
48
| _ => link
45
49
}
46
50
)
47
- -> Array .map ( link => <LinkCard link key = link .title />)
51
+ -> Array .mapWithIndex (( link , index ) => <LinkCard link key = link .title index />)
48
52
-> React .array }
49
53
</div >
50
54
}
You can’t perform that action at this time.
0 commit comments