소스 검색

fix: show the name on every iPhone; keep Eric's face on theme switch

The gradient name now holds a single text node, the one shape of
background-clip: text that every Safari paints, and it no longer has its
own fade on font load. The melt wave weighs the name as a whole.

Switching light and dark showed Bert: the view transition's snapshot
ignores backface-visibility, so the back of the avatar painted on top.
Each face is now hidden outright while it faces away, switching as the
flip passes edge-on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QEPoSHwHCYMNpm2iKxY9hL
Claude 1 개월 전
부모
커밋
0c4644d012
3개의 변경된 파일과 27개의 추가작업 그리고 10개의 파일을 삭제
  1. 19 3
      components/cards/avatar-flip.tsx
  2. 7 6
      components/cards/hero-title.tsx
  3. 1 1
      styles/globals.css

+ 19 - 3
components/cards/avatar-flip.tsx

@@ -1,10 +1,20 @@
 "use client";
 
 import Image from "next/image";
-import { useEffect, useState } from "react";
+import { useEffect, useState, type CSSProperties } from "react";
 
 import { cn, onIdle } from "@/lib/utils";
 
+/**
+ * Each face is hidden outright while it's turned away, switching as the flip
+ * passes edge-on (114 ms into the spring below). backface-visibility alone isn't
+ * enough: the theme switch's snapshot ignores it, which showed Bert.
+ */
+const face = (shown: boolean): CSSProperties => ({
+  visibility: shown ? "visible" : "hidden",
+  transition: "visibility 0s linear 114ms",
+});
+
 /** Tap the avatar to flip it over and meet Bert. */
 export function AvatarFlip({
   avatarUrl,
@@ -48,7 +58,10 @@ export function AvatarFlip({
         className="relative block size-full transition-transform duration-[900ms] [transform-style:preserve-3d] [transition-timing-function:cubic-bezier(.3,1.35,.45,1)] group-active:scale-95"
         style={{ transform: flipped ? "rotateY(180deg)" : undefined }}
       >
-        <span className="absolute inset-0 overflow-hidden rounded-full shadow-[0_8px_24px_-10px_rgb(0_0_0/0.45)] ring-1 ring-line [backface-visibility:hidden]">
+        <span
+          className="absolute inset-0 overflow-hidden rounded-full shadow-[0_8px_24px_-10px_rgb(0_0_0/0.45)] ring-1 ring-line [backface-visibility:hidden]"
+          style={face(!flipped)}
+        >
           <Image
             fill
             preload
@@ -58,7 +71,10 @@ export function AvatarFlip({
             src={avatarUrl}
           />
         </span>
-        <span className="absolute inset-0 overflow-hidden rounded-full bg-card-2 ring-1 ring-line [backface-visibility:hidden] [transform:rotateY(180deg)]">
+        <span
+          className="absolute inset-0 overflow-hidden rounded-full bg-card-2 ring-1 ring-line [backface-visibility:hidden] [transform:rotateY(180deg)]"
+          style={face(flipped)}
+        >
           {showDog && (
             <Image
               fill

+ 7 - 6
components/cards/hero-title.tsx

@@ -16,10 +16,10 @@ const FILTER_ID = "hero-droplet-lens";
 /** Matches the wrapper's px-1/py-1, so the clone inside the lens lines up with the title. */
 const PAD = 4;
 
-const letter = (ch: string, i: number, block = true) => (
+const letter = (ch: string, i: number) => (
   <span
     key={i}
-    className={cn(block && "inline-block", ch === " " && "w-[0.24em]")}
+    className={cn("inline-block", ch === " " && "w-[0.24em]")}
     data-wave={i}
     style={REST}
   >
@@ -38,10 +38,11 @@ function Title({ clone }: { clone?: boolean }) {
       <span aria-hidden>
         {LEAD.split("").map((ch, i) => letter(ch, i))}
         <span className="hero-tail inline-block">
-          {/* Plain inline letters: WebKit clips the gradient only to the
-              name's own inline text, so inline-block letters would vanish. */}
-          <span className="hero-name">
-            {NAME.split("").map((ch, j) => letter(ch, LEAD.length + j, false))}
+          {/* One plain text node, the one form of background-clip: text every
+              Safari paints: split into letters, the gradient name vanished on
+              iPhone. The wave weighs the name as a whole. */}
+          <span className="hero-name" data-wave={LEAD.length} style={REST}>
+            {NAME}
           </span>
           <span
             className="inline-block"

+ 1 - 1
styles/globals.css

@@ -58,7 +58,7 @@ html.ff {
 }
 
 /* A gentle settle when the display face swaps in. */
-.ff-in :is(.font-display, .title, .hero-name) {
+.ff-in :is(.font-display, .title) {
   animation: ff-settle 0.5s ease both;
 }