From 231c80039561ca5e2c4305e2e44741f63f959105 Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Thu, 13 Mar 2025 15:19:46 -0400 Subject: [PATCH] lazy load images below the fold for community content and blog page --- src/Blog.res | 6 +++--- src/CommunityContent.res | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Blog.res b/src/Blog.res index 91b2e8844..47d4e8c61 100644 --- a/src/Blog.res +++ b/src/Blog.res @@ -95,8 +95,8 @@ module BlogCard = { { let className = "absolute top-0 h-full w-full object-cover" switch previewImg { - | Some(src) => - | None => + | Some(src) => + | None => } } @@ -155,7 +155,7 @@ module FeatureCard = { let className = "absolute top-0 h-full w-full object-cover" switch previewImg { | Some(src) => - | None => + | None => } } diff --git a/src/CommunityContent.res b/src/CommunityContent.res index 0f9ff49ac..846ae9905 100644 --- a/src/CommunityContent.res +++ b/src/CommunityContent.res @@ -17,10 +17,14 @@ let simplifyUrl = url => module LinkCard = { @react.component - let make = (~link) => { + let make = (~link, ~index) => { + let loading = switch index { + | 0 => #eager + | _ => #"lazy" + }
- +

{React.string(link.title)}

{React.string(link.description)}

@@ -44,7 +48,7 @@ module LinkCards = { | _ => link } ) - ->Array.map(link => ) + ->Array.mapWithIndex((link, index) => ) ->React.array}
}