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
34 lines
2.0 KiB
TypeScript
34 lines
2.0 KiB
TypeScript
'use client';
|
|
/* Odometer (v2): a figure whose digits roll like a counter when it changes - the "rolling price" of VISION.md.
|
|
Usage:
|
|
import Odometer from '../v2/Odometer';
|
|
<Odometer value="$195" /> // any string: digits roll, everything else ($ , . x /) sits still
|
|
<Odometer value={`$${total}`} className="big" />
|
|
- The real value is plain text in the HTML (screen readers, search, the parity check); the rolling columns are
|
|
aria-hidden and draw their 0-9 strip with CSS, so no extra digits end up in the page's text.
|
|
- Each digit is a column that slides to its digit (CSS transform, 300 ms, EASE, PLAN-COMPONENTS 5.2), the ones place
|
|
first and each place to its left 20 ms later. It only ever rolls between two real values: on first paint the figure
|
|
stands still at its value, so it never flashes a number that is not the source's (no roll up from 0).
|
|
- No JS loop: the browser runs it. Reduced motion: the figure just changes.
|
|
- Size it with font-size on the element; use tabular figures (it sets font-feature-settings: 'tnum').
|
|
Owned by the Enterprise + Pricing chat (v2 wave 1). */
|
|
import type { CSSProperties } from 'react';
|
|
import './Odometer.css';
|
|
|
|
export default function Odometer({ value, className = '' }: { value: string | number; className?: string }) {
|
|
const chars = [...String(value)];
|
|
const n = chars.length;
|
|
return (
|
|
<span className={'v2-odo' + (className ? ' ' + className : '')}>
|
|
<span className="v2-odo-t">{value}</span>
|
|
<span className="v2-odo-r" aria-hidden="true">
|
|
{chars.map((c, i) => {
|
|
const place = n - 1 - i; // keyed from the right, so the ones place stays the same column
|
|
if (!/[0-9]/.test(c)) return <span key={'c' + place + c} className="v2-odo-c">{c}</span>;
|
|
return <span key={'d' + place} className="v2-odo-d" style={{ '--d': +c, '--i': place } as CSSProperties}><span className="v2-odo-s" /></span>;
|
|
})}
|
|
</span>
|
|
</span>
|
|
);
|
|
}
|