Customer order lifecycle on the mono design system: red + provenance tokens, useReveal hook, lib/data pricing model, ProvenanceBadge/CellProvenance, OrderStepper, and 4 routes with live pricing, 50/50 escrow, simulated production, 4-view validation. tsc clean; next build green (5 routes). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
979 B
TypeScript
34 lines
979 B
TypeScript
"use client";
|
|
|
|
import { useEffect, useRef } from "react";
|
|
|
|
/**
|
|
* Wire a section so its descendants carrying `.reveal` (+ optional
|
|
* `.reveal-left|-right|-scale|-fade` and `.delay-N`) animate in when the
|
|
* section scrolls into view. Matches the keyframes in globals.css.
|
|
*/
|
|
export function useReveal<T extends HTMLElement = HTMLElement>() {
|
|
const ref = useRef<T>(null);
|
|
useEffect(() => {
|
|
const el = ref.current;
|
|
if (!el) return;
|
|
const io = new IntersectionObserver(
|
|
(entries) =>
|
|
entries.forEach((e) => {
|
|
if (e.isIntersecting) {
|
|
el
|
|
.querySelectorAll(
|
|
".reveal, .reveal-left, .reveal-right, .reveal-scale, .reveal-fade",
|
|
)
|
|
.forEach((n) => n.classList.add("in-view"));
|
|
io.unobserve(el);
|
|
}
|
|
}),
|
|
{ threshold: 0.15, rootMargin: "0px 0px -10% 0px" },
|
|
);
|
|
io.observe(el);
|
|
return () => io.disconnect();
|
|
}, []);
|
|
return ref;
|
|
}
|