mirror of
https://github.com/hanzoai/site.git
synced 2026-11-21 01:07:08 +00:00
* Type page props, hook state and helper parameters from their call sites First pass of the strict typing of components/pages (About to cloudfam): destructured props get an interface built from the JSX that renders them, refs and state get their element and value types, plain parameters get the type their callers or body fix. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type pages (careers, calculator, blog, brand, cli) from their data and call sites Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type the cloud pages from their scenes and hooks Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * wip * Type the remaining pages under strict Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
'use client';
|
|
/* /cli only: a headline whose lines rise out of their own masks once, when half of it is on screen.
|
|
Page-local stand-in for v2/x-edison/AppLines (shared, not ours): the server HTML is the final frame (no inline
|
|
transform), so JS off is legible and reduced motion hydrates without a mismatch. The mask is a CSS class:
|
|
`.js .cli-cut:not(.in)` holds each line at translateY(108%); `.in` lets it rise (700 ms, ease-emphasis, 60 ms apart).
|
|
Usage: <Cut as="h2" id="x" className="av-head" lines={['Install, sign in,', 'start working']} /> */
|
|
import { useRef } from 'react';
|
|
import { useInView } from 'motion/react';
|
|
|
|
interface CutProps {
|
|
lines: string[];
|
|
as?: 'h1' | 'h2' | 'h3';
|
|
className?: string;
|
|
id: string;
|
|
}
|
|
export default function Cut({ lines, as = 'h2', className = '', id }: CutProps) {
|
|
const ref = useRef<HTMLHeadingElement>(null);
|
|
const seen = useInView(ref, { once: true, amount: 0.5 });
|
|
const Tag = as;
|
|
return (
|
|
<Tag ref={ref} id={id} className={'cli-cut ' + (seen ? 'in ' : '') + className}>
|
|
{lines.map((l, i) => (
|
|
<span key={i} className="cli-cut-m">
|
|
<span className="cli-cut-l" style={{ '--d': i * 60 + 'ms' }}>{l}{i < lines.length - 1 ? ' ' : ''}</span>
|
|
</span>
|
|
))}
|
|
</Tag>
|
|
);
|
|
}
|