import Heading from "@theme/Heading";
import { HardwareMetadata } from "../hardware-metadata";
import { groupedMetadata, InterconnectDetails } from "./hardware-utils";
interface HardwareListProps {
items: HardwareMetadata[];
}
type ElementOrString = JSX.Element | string;
function itemHasMultiple(item: HardwareMetadata) {
return (
(item.type == "board" || item.type == "shield") &&
(item.siblings?.length ?? 1) > 1
);
}
function itemIds(item: HardwareMetadata) {
if (item.type == "board" || item.type == "shield") {
const nodes = (item.siblings ?? [item.id])
.map((id) => {id})
.reduce<
ElementOrString[]
>((prev, curr, index) => [...prev, index > 0 ? ", " : "", curr], []);
return {nodes};
} else {
return {item.id};
}
}
const TYPE_LABELS: Record<
HardwareMetadata["type"],
Record<"singular" | "plural", string>
> = {
board: { plural: "Boards: ", singular: "Board: " },
shield: { singular: "Shield: ", plural: "Shields: " },
interconnect: { singular: "Interconnect: ", plural: "Interconnects: " },
};
function HardwareLineItem({ item }: { item: HardwareMetadata }) {
return (
{interconnect.description}
}Keyboards with onboard controllers are single PCBs that contain all the components of a keyboard, including the controller chip, switch footprints, etc.
Composite keyboards are composed of two main PCBs: a small controller board with exposed pads, and a larger keyboard PCB (a shield, in ZMK lingo) with switch footprints and a location where the controller is added. This location is called an interconnect. Multiple interconnects can be found below.
{Object.values(grouped.interconnects).map(mapInterconnect)}