| 1 | /** Static Signal Current mark from the managed Codewhale product contract. */ |
| 2 | const WHALE_BODY = |
| 3 | "M7 57c9-13 21-15 25-25 3-7-1-12-10-16 6-1 11 1 14 6 3-6 10-11 19-13-1 10-5 17-12 21-4 3-5 8-8 14-5 9-15 14-28 13Z"; |
| 4 | const WHALE_CURRENT = "M28 58c10-8 15-15 17-26 4 8 2 18-3 26H28Z"; |
| 5 | |
| 6 | export function Whale({ |
| 7 | size = 36, |
| 8 | className = "", |
| 9 | caustic = false, |
| 10 | }: { |
| 11 | size?: number; |
| 12 | className?: string; |
| 13 | /** |
| 14 | * Ambient light passing over the mark — `ambient_life.rs`'s caustic at its |
| 15 | * literal amplitude and cadence. Exactly one whale on the page may carry it |
| 16 | * (the footer's); two caustics is chrome. The fixed gradient/clip ids are |
| 17 | * safe for the same reason. |
| 18 | */ |
| 19 | caustic?: boolean; |
| 20 | }) { |
| 21 | return ( |
| 22 | <svg |
| 23 | viewBox="0 0 64 64" |
| 24 | width={size} |
| 25 | height={size} |
| 26 | className={`codewhale-mark ${className}`} |
| 27 | aria-hidden="true" |
| 28 | fill="none" |
| 29 | > |
| 30 | {caustic ? ( |
| 31 | <defs> |
| 32 | <clipPath id="codewhale-caustic-clip"> |
| 33 | <path d={WHALE_BODY} /> |
| 34 | <path d={WHALE_CURRENT} /> |
| 35 | </clipPath> |
| 36 | <linearGradient id="codewhale-caustic-light" x1="0" y1="0" x2="1" y2="0"> |
| 37 | <stop offset="0%" stopColor="#d1ebf4" stopOpacity="0" /> |
| 38 | <stop offset="50%" stopColor="#d1ebf4" stopOpacity="0.33" /> |
| 39 | <stop offset="100%" stopColor="#d1ebf4" stopOpacity="0" /> |
| 40 | </linearGradient> |
| 41 | </defs> |
| 42 | ) : null} |
| 43 | |
| 44 | <path className="codewhale-mark-primary" d={WHALE_BODY} /> |
| 45 | <path className="codewhale-mark-current" d={WHALE_CURRENT} /> |
| 46 | |
| 47 | {/* The light is clipped to the mark itself, so it lands on the whale and |
| 48 | never on a rectangle of footer behind it. The clip lives on a STATIC |
| 49 | group and the highlight moves inside it — put the clip on the moving |
| 50 | rect and the whale-shaped window slides along with the light, which |
| 51 | is a very quiet way to render nothing at all. Parked off-canvas at |
| 52 | rest, which is also where reduced motion leaves it. */} |
| 53 | {caustic ? ( |
| 54 | <g clipPath="url(#codewhale-caustic-clip)"> |
| 55 | <rect |
| 56 | className="codewhale-caustic" |
| 57 | x="-56" |
| 58 | y="0" |
| 59 | width="48" |
| 60 | height="64" |
| 61 | fill="url(#codewhale-caustic-light)" |
| 62 | /> |
| 63 | </g> |
| 64 | ) : null} |
| 65 | </svg> |
| 66 | ); |
| 67 | } |
| 68 |