"use client" /** * A segmented environment switcher (production / preview / …). Controlled: the * host owns `value` and re-scopes its data on `onChange`. Neutral design tokens * only, so it renders in any brand. */ import { Text, XStack } from "@hanzo/gui" import type { EnvOption } from "./types" export interface EnvSwitcherProps { options: EnvOption[] value: string onChange: (id: string) => void size?: "sm" | "md" } export function EnvSwitcher({ options, value, onChange, size = "md", }: EnvSwitcherProps) { const fs = size === "sm" ? "$1" : "$2" return ( {options.map((o) => { const active = o.id === value return ( onChange(o.id)} style={{ cursor: "pointer", boxShadow: active ? "0 1px 2px rgba(0,0,0,0.12)" : undefined, }} > {o.label} {o.count != null ? ( {o.count} ) : null} ) })} ) }