"use client"; import { useState, type CSSProperties, type KeyboardEvent } from "react"; import "./roll-call.css"; export type Person = { name: string; role: string; color: string }; export function RollCall({ people, className = "" }: { people: Person[]; className?: string }) { const [active, setActive] = useState(null); const key = (e: KeyboardEvent) => { if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return; e.preventDefault(); const items = Array.from(e.currentTarget.querySelectorAll("button")); const i = items.indexOf(document.activeElement as HTMLButtonElement); items[(i + (e.key === "ArrowDown" ? 1 : -1) + items.length) % items.length]?.focus(); }; return (
    setActive(null)}> {people.map((p, i) => (
  • ))}
); }