/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: CC-BY-NC-SA-4.0
*/
import React from "react";
import PropTypes from "prop-types";
import TableRow from "./TableRow";
import Footnotes from "./Footnotes";
import LinkIcon from "./LinkIcon";
import operatingSystems from "@site/src/data/operating-systems";
import { getCodes } from "@site/src/hid";
import { getGroup } from "@site/src/groups";
import { getFootnote } from "@site/src/footnotes";
function extractFootnoteIds(codes) {
return Array.from(
new Set(
codes
.flatMap(({ footnotes }) => Object.values(footnotes))
.flatMap((refs) => (Array.isArray(refs) ? refs.flat() : refs))
)
);
}
export default function Table({ group }) {
const codes = getCodes(getGroup(group));
const footnotesAnchor = group + "-" + "footnotes";
const tableFootnotes = extractFootnoteIds(codes).map((id, i) => {
const Component = getFootnote(id);
return {
id,
anchor: footnotesAnchor,
symbol: i + 1,
value: Component ?
Names | Description |
|
{operatingSystems.map(({ key, className, heading, title }) => (
{heading} | ))}
---|