Replace blur placeholder with opacity fade-in on hero screenshot (#278)

This commit is contained in:
Lawrence Chen 2026-02-21 06:24:59 -08:00 committed by GitHub
parent 4f1d120d2e
commit 64bb248f20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 3 deletions

View file

@ -0,0 +1,17 @@
"use client";
import Image, { type ImageProps } from "next/image";
import { useState } from "react";
export function FadeImage(props: ImageProps) {
const [loaded, setLoaded] = useState(false);
return (
<Image
{...props}
placeholder={undefined}
className={`${props.className ?? ""} transition-opacity duration-700 ${loaded ? "opacity-100" : "opacity-0"}`}
onLoad={() => setLoaded(true)}
/>
);
}

View file

@ -1,4 +1,4 @@
import Image from "next/image";
import { FadeImage } from "./components/fade-image";
import Balancer from "react-wrap-balancer";
import landingImage from "./assets/landing-image.png";
import { TypingTagline } from "./typing";
@ -117,11 +117,10 @@ export default function Home() {
{/* Screenshot - break out of max-w-2xl to be wider */}
<div data-dev="screenshot" className="mb-12 -mx-6 sm:-mx-24 md:-mx-40 lg:-mx-72 xl:-mx-96">
<Image
<FadeImage
src={landingImage}
alt="cmux terminal app screenshot"
priority
placeholder="blur"
className="w-full rounded-xl"
/>
</div>