mirror of
https://github.com/hanzoai/site.git
synced 2026-11-20 21:21:13 +00:00
* Type scripts under strict Playwright's API the checks use is declared in host.ts (the package is the app repo's); caught errors read through why(). tabs-tree.test waits for the typed tabsTree. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type the shared components under strict Window globals (__lenis, __hzHold, google) and the two react-dom calls are declared in components/*.d.ts, since @types/react-dom is not a dependency and the lockfile is frozen. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type components/v2 under strict Props, state, refs and DOM events in the 93 v2 files. A2Motion's easing tuples are as const. Two real bugs: x-archimedes/MaskLines imported a NoJs that does not exist, and x-hypatia/PinChapters returned the element from a ref callback, which React 19 reads as a cleanup. AppSheet no longer sets aria-label to a JSX label. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type components/home under strict The race, cost and frontier figures, the plan cards, the repository card and the product stories take Run, Models and Plan types from lib. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type the hero devices and the app routes under strict HeroScene and its parts describe hero-scenes.json; the [slug] pages take params as a Promise, and metadata and viewport carry Next's types. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Give the integrations previews their Preview type Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Use the bench Card type for the closing cards Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
41 lines
2.3 KiB
TypeScript
41 lines
2.3 KiB
TypeScript
'use client';
|
|
/* SceneWipe (components/v2, owned by the Wave 2 "Proof" chat). A scene change with no hard edge (VISION.md motion 7):
|
|
the section's room (dark by default) arrives as a rounded panel inset from the page and opens to full bleed as you
|
|
scroll into it, by clip-path only. Use it for the page's one dark room.
|
|
Usage: <SceneWipe className="xtr-dark" label="…">…content…</SceneWipe>
|
|
Props: dark (default true; sets data-room="dark" so the header turns dark), tone (the room's colour, default #000),
|
|
label (aria-label), id. Reduced motion and phones: the room is simply there, full bleed. */
|
|
import { useEffect, useRef, useState, type ReactNode } from 'react';
|
|
import { motion, useMotionTemplate, useReducedMotion, useScroll, useTransform } from 'motion/react';
|
|
import './ProofScale.css';
|
|
|
|
interface SceneWipeProps {
|
|
children?: ReactNode;
|
|
className?: string;
|
|
dark?: boolean;
|
|
tone?: string;
|
|
label?: string;
|
|
id?: string;
|
|
}
|
|
|
|
export default function SceneWipe({ children, className = '', dark = true, tone = '#000', label, id }: SceneWipeProps) {
|
|
const ref = useRef<HTMLElement>(null);
|
|
const r0 = useReducedMotion();
|
|
const [reduce, setReduce] = useState(false); // read after mount, so the first render matches the server's HTML
|
|
useEffect(() => setReduce(!!r0), [r0]);
|
|
const [wide, setWide] = useState(true);
|
|
useEffect(() => { const m = matchMedia('(min-width: 901px)'); const f = () => setWide(m.matches); f(); m.addEventListener('change', f); return () => m.removeEventListener('change', f); }, []);
|
|
const { scrollYProgress } = useScroll({ target: ref, offset: ['start end', 'start 0.1'] });
|
|
const side = useTransform(scrollYProgress, [0, 1], [5, 0]);
|
|
const top = useTransform(scrollYProgress, [0, 1], [56, 0]);
|
|
const round = useTransform(scrollYProgress, [0, 1], [40, 0]);
|
|
const clip = useMotionTemplate`inset(${top}px ${side}% 0px ${side}% round ${round}px ${round}px 0px 0px)`;
|
|
const still = reduce || !wide;
|
|
return (
|
|
<section ref={ref} id={id} className={'pf-wipe ' + className} data-room={dark ? 'dark' : undefined} aria-label={label} style={{ position: 'relative', isolation: 'isolate', color: dark ? '#f5f5f7' : undefined }}>
|
|
<motion.div aria-hidden="true" style={{ position: 'absolute', inset: 0, zIndex: -1, background: tone, clipPath: still ? 'none' : clip }} />
|
|
{children}
|
|
</section>
|
|
);
|
|
}
|