Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,13 @@ code {
/* Card media fades in over the always-present duck fallback layer. */
.media-layer { opacity: 0; transition: opacity 240ms ease; }
.media-layer.media-ready { opacity: 1; }
/* ...and the duck fades out with it: the Pollen clips are alpha-transparent
WebMs, so a lingering duck would show through the transparent regions. */
.media-fallback-card { transition: opacity 240ms ease; }
.media-fallback-card.media-fallback-hidden { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
.media-layer { transition: none; }
.media-layer,
.media-fallback-card { transition: none; }
}

.behavior-media-cue {
Expand Down
12 changes: 10 additions & 2 deletions src/components/MediaPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,12 @@ export function MediaPreview({ media, title, variant }: MediaPreviewProps) {
// case that the hydration race makes untrustworthy via events alone.)
useEffect(() => setVideoReady(false), [videoUrl, showVideo]);

// Cards crossfade: when the media layer reveals, the duck fallback fades
// out — necessary because the Pollen clips are alpha-transparent WebMs,
// so an opaque-feeling video would still show the duck through it.
const mediaRevealed = showVideo ? videoReady : imageLoaded;
const layerClass = variant === "card"
? ` media-layer${(showVideo ? videoReady : imageLoaded) ? " media-ready" : ""}`
? ` media-layer${mediaRevealed ? " media-ready" : ""}`
: "";

let mediaNode: ReactNode = null;
Expand Down Expand Up @@ -199,7 +203,11 @@ export function MediaPreview({ media, title, variant }: MediaPreviewProps) {
if (variant === "card") {
return (
<>
<div ref={observeMedia} className="media-fallback media-fallback-card" aria-hidden="true">
<div
ref={observeMedia}
className={`media-fallback media-fallback-card${mediaRevealed ? " media-fallback-hidden" : ""}`}
aria-hidden="true"
>
<DuckMark size={48} />
</div>
{mediaNode}
Expand Down