Repository navigation
perf(images): replace raw <img> with next/image across the site - #49
Merged
Merged
Conversation
All 26 <img> occurrences converted to next/image: - local assets get explicit width/height (measured) to prevent CLS - allowed remote hosts (imagekit, ytimg) use fill + sizes - GitHub avatars moved to avatars.githubusercontent.com (domain added to remotePatterns) - third-party/dynamic sources use unoptimized (no allowlist changes) Raw <img> bypasses WebP/AVIF conversion, responsive resizing and lazy loading. tsc --noEmit passes with zero errors. Closes #40
|
@Furox-Art is attempting to deploy a commit to the GDG On Campus AEC's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #40
What
Replaced every raw
<img>element with the framework's optimized imagecomponent (
next/image). All 26 occurrences across 11 files wereconverted; only the framer-motion
motion.imgin the lightbox is leftas-is (it is animation-driven with dynamic sizing, see "Left
intentionally" below).
How each category was handled
/balloon.svg,/gdsc-logo.png,/cloud-white-3.svg,/gallery-1.gif, team photo, ...): givenexplicit
width/heightfrom the real file dimensions (measured withImageMagick), which lets the browser reserve space and eliminates CLS.
ik.imagekit.io,i.ytimg.com):fill+sizesso they render responsive and getautomatic WebP/AVIF conversion.
avatars.githubusercontent.com): switched from thelegacy
github.com/<user>.pngURL to the proper avatar endpoint andadded the domain to
next.config.tsremotePatterns.sprites, admin thumbnails, courses):
unoptimizedso the optimizer isbypassed for hosts not in the allowlist — the component is still used
(lazy loading + responsive behavior preserved), the build does not
require new allowlist entries.
What this fixes
Raw
<img>bypasses automatic format conversion (WebP/AVIF), responsiveresizing, and lazy loading, which causes Cumulative Layout Shift on
slower connections.
next/imageaddresses all three.Tests performed
npx tsc --noEmit -p tsconfig.json— passes with zero errors.next build— compiles successfully (the TypeScript stage passes);the only build failure is a pre-existing
ImageKitpublicKeyenvrequirement unrelated to this change (it fails on
maintoo without.env).<img>elements remain and 30<Image>components + 11
next/imageimports are in place.Left intentionally
motion.imginCinematicLightbox.tsx— animated by framer-motionwith
max-h-[60vh] object-containdynamic sizing; converting it wouldchange the lightbox's animation behavior. Better left for a dedicated
change.