// Shared atoms const { useState: useStateA, useEffect: useEffectA } = React; const Dot = ({ c = "var(--ink-3)", size = 6 }) => ( ); const Pill = ({ children, tone = "ink" }) => { const tones = { ink: { bg: "var(--bg-2)", fg: "var(--ink-2)", bd: "var(--line)" }, accent: { bg: "var(--accent-soft)", fg: "var(--accent)", bd: "transparent" }, warn: { bg: "var(--warn-soft)", fg: "var(--warn)", bd: "transparent" }, }[tone]; return ( {children} ); }; const Btn = ({ children, variant = "primary", href = "#", onClick, small }) => { const base = { display: "inline-flex", alignItems: "center", gap: 8, padding: small ? "8px 14px" : "12px 18px", borderRadius: 8, fontSize: small ? 13 : 14, fontWeight: 500, cursor: "pointer", border: "1px solid transparent", transition: "all 120ms ease", }; const variants = { primary: { ...base, background: "var(--ink)", color: "var(--bg)" }, ghost: { ...base, background: "transparent", color: "var(--ink)", borderColor: "var(--line)" }, }; return ( { if (variant === "primary") e.currentTarget.style.background = "var(--ink-2)"; if (variant === "ghost") e.currentTarget.style.background = "var(--bg-2)"; }} onMouseLeave={e => { if (variant === "primary") e.currentTarget.style.background = "var(--ink)"; if (variant === "ghost") e.currentTarget.style.background = "transparent"; }}> {children} ); }; // WideWired logo. Two variants: // - product: the header/nav mark. Chinese version shows "WideWired / 网迅达" when lang=zh. // - company: the footer mark, always English (company brand, not product brand). const LogoMark = ({ size = 22, lang, variant = "company" }) => { const src = useThemeLogoA(variant === "product" && lang === "zh"); return ( WideWired ); }; function useThemeLogoA(useCN = false) { const pick = (t) => { if (useCN) return t === "dark" ? "assets/widewired-logo-cn-white.svg" : "assets/widewired-logo-cn.svg"; return t === "dark" ? "assets/widewired-logo-white.svg" : "assets/widewired-logo-ink.svg"; }; const [src, setSrc] = useStateA(() => { const t = typeof document !== "undefined" ? document.documentElement.dataset.theme : "light"; return pick(t); }); useEffectA(() => { const update = () => setSrc(pick(document.documentElement.dataset.theme)); update(); const obs = new MutationObserver(update); obs.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] }); return () => obs.disconnect(); }, [useCN]); return src; } function SectionHeader({ kicker, title, subtitle, body, subtitleNoWrap }) { return (
{kicker}

{title}{subtitle && <>
{subtitle}}

{body &&

{body}

}
); } function Nav({ ctx, theme, toggleTheme, lang, setLang }) { const [scrolled, setScrolled] = useStateA(false); useEffectA(() => { const onScroll = () => setScrolled(window.scrollY > 8); window.addEventListener("scroll", onScroll); return () => window.removeEventListener("scroll", onScroll); }, []); const { t } = ctx; return (
{["en", "zh"].map(l => ( ))}
{t.nav.signin}
); } function TweaksPanel({ state, setState, onReset }) { return (
Tweaks
setState({ ...state, lang: v })}/> setState({ ...state, theme: v })}/> setState({ ...state, accent: +e.target.value })} style={{ width: "100%" }}/>
oklch(.62 .13 {state.accent})
); } const TweakRow = ({ label, children }) => (
{label}
{children}
); const Segmented = ({ value, options, onChange }) => (
{options.map(([k, l]) => ( ))}
); Object.assign(window, { Dot, Pill, Btn, LogoMark, SectionHeader, Nav, TweaksPanel });