Skip to content

Commit

Permalink
🔥 further optimized image and svg delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
parchinski committed Oct 24, 2024
1 parent 34b4000 commit f0ad060
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function Header() {
src="/hackucf-logo.svg"
alt="HackUCF Logo"
className="w-48 md:w-64"
loading="lazy"
loading="eager"
/>
</Link>
</div>
Expand Down
7 changes: 3 additions & 4 deletions app/components/image-carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,15 @@ export default function ImageCarousel({ imagePaths, alt }: ImageCarouselProps) {
return `translateX(-${currentIndex * 100}%)`;
};

const renderImage = (path: string, imageAlt: string, priority = false) => (
const renderImage = (path: string, imageAlt: string) => (
<Image
src={`/${path}`}
alt={imageAlt}
layout="constrained"
width={1112}
height={834}
className="w-full h-auto"
priority={priority}
loading={priority ? 'eager' : 'lazy'}
loading={'eager'}
/>
);

Expand Down Expand Up @@ -85,7 +84,7 @@ export default function ImageCarousel({ imagePaths, alt }: ImageCarouselProps) {
key={generateUniqueId('main', image)}
className="w-full flex-shrink-0"
>
{renderImage(image, `${alt} ${index + 1}`, index === 0)}
{renderImage(image, `${alt} ${index + 1}`)}
</div>
))}

Expand Down

0 comments on commit f0ad060

Please sign in to comment.