Files
zeekayandGitHub ea43c5a975 Type lib, scripts, v2, home and app under strict (#8)
* 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
2026-11-14 01:34:34 -08:00

59 lines
2.3 KiB
TypeScript

'use client';
/* Answers (v2): questions that open in place, and nothing else moves.
Usage:
import Answers from '../v2/Answers';
<Answers items={[[question, answer], ...]} /> // answer can be a string or JSX with links
<Answers items={qa} start={-1} dark /> // start closed; on a dark room
- One answer open at a time (the first by default). Every answer stays in the HTML, collapsed, for search engines,
find-in-page and the parity check.
- No entrance animation: the list sits still and reads. The only motion is the answer opening (360 ms, EASE) and the
plus turning into a minus. Reduced motion opens it instantly (MotionConfig is global).
- Real buttons with aria-expanded/aria-controls; the question is a heading so screen readers can jump between them.
Owned by the Enterprise + Pricing chat (v2 wave 1). */
import { useId, useState } from 'react';
import type { ReactNode } from 'react';
import { motion } from 'motion/react';
import './Answers.css';
const EASE = [0.16, 1, 0.3, 1] as const;
interface AnswersProps {
items: ReadonlyArray<readonly [string, ReactNode]>;
start?: number;
dark?: boolean;
className?: string;
}
export default function Answers({ items, start = 0, dark = false, className = '' }: AnswersProps) {
const [open, setOpen] = useState(start);
const id = useId();
return (
<ul className={'v2-ans' + (dark ? ' dark' : '') + (className ? ' ' + className : '')}>
{items.map(([q, a], i) => {
const on = open === i;
return (
<li key={q} className={on ? 'on' : undefined}>
<h3>
<button type="button" aria-expanded={on} aria-controls={id + i} onClick={() => setOpen(on ? -1 : i)}>
<span>{q}</span>
<i aria-hidden="true" />
</button>
</h3>
<motion.div
id={id + i}
className="v2-ans-a"
initial={false}
animate={on ? { height: 'auto', opacity: 1 } : { height: 0, opacity: 0 }}
transition={{ duration: 0.36, ease: EASE }}
aria-hidden={!on}
inert={!on}
>
<div>{a}</div>
</motion.div>
</li>
);
})}
</ul>
);
}