import { motion, useScroll, useSpring } from "motion/react";
import { useEffect, useState } from "react";
import { useI18n } from "../i18n";
import type { Lang } from "../i18n/strings";
import { Link } from "../lib/router";
import { Mark } from "./Icons";
export function LangToggle() {
const { lang, setLang, t } = useI18n();
return (
{(["ru", "en"] as Lang[]).map((l) => (
setLang(l)}>
{l.toUpperCase()}
))}
);
}
export function Wordmark({ sub }: { sub?: string }) {
return (
CarPrint
{sub && {sub} }
);
}
/** Landing navigation: transparent over the film, solid ink once the page scrolls. */
export function LandingNav() {
const { t } = useI18n();
const [solid, setSolid] = useState(false);
const [open, setOpen] = useState(false);
const { scrollYProgress } = useScroll();
const progress = useSpring(scrollYProgress, { stiffness: 200, damping: 40, mass: 0.3 });
useEffect(() => {
const onScroll = () => setSolid(window.scrollY > 40);
onScroll();
window.addEventListener("scroll", onScroll, { passive: true });
return () => window.removeEventListener("scroll", onScroll);
}, []);
const links: [string, string][] = [
["#problem", t.nav.problem], ["#how", t.nav.how], ["#evidence", t.nav.evidence], ["#estimate", t.nav.estimate],
["#numbers", t.nav.numbers], ["#limits", t.nav.limits], ["#business", t.nav.business], ["#science", t.nav.science],
];
return (
);
}