Makes Reveal, deferred images and the first row work from the HTML

Reveal content is visible in the HTML and only content below the viewport hides
after hydration. Deferred photos get a noscript twin, and the first row of the
portfolio loads eagerly per column count. Some old tests still expect the former
behaviour; they are rewritten next, so this commit's test run is not fully green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 22:57:05 +01:00
co-authored by Claude Opus 5.5
parent 4139c8f732
commit 44125155bc
19 changed files with 422 additions and 70 deletions
+20 -8
View File
@@ -6,11 +6,12 @@ type RevealProps = BoxProps & {
delay?: number;
};
// Fades its content in and up once it scrolls into view (design .reveal).
// The content is always in the DOM and readable by assistive technology;
// only its opacity and position change.
// Fades its content in and up once it scrolls into view (design .reveal),
// when it started wholly below the viewport; content in view is simply
// shown. The content is always in the DOM and readable by assistive
// technology; only its opacity and position change.
export default function Reveal({ delay = 0, children, ...rest }: RevealProps) {
const { ref, visible } = useReveal<HTMLDivElement>();
const { ref, visible, animated } = useReveal<HTMLDivElement>();
return (
<Box
@@ -18,10 +19,21 @@ export default function Reveal({ delay = 0, children, ...rest }: RevealProps) {
data-reveal={visible ? 'visible' : 'hidden'}
opacity={visible ? 1 : 0}
transform={visible ? 'none' : 'translateY(24px)'}
transitionProperty="opacity, transform"
transitionDuration="reveal"
transitionTimingFunction="smooth"
transitionDelay={`${delay}s`}
{...(animated
? {
transitionProperty: 'opacity, transform',
transitionDuration: 'reveal',
transitionTimingFunction: 'smooth',
transitionDelay: `${delay}s`,
}
: { transition: 'none' })}
// A preference that changes while elements are hidden shows them
// at once
_motionReduce={{
opacity: 1,
transform: 'none',
transition: 'none',
}}
{...rest}
>
{children}