CodeMapRow

tcmts.share.CodeMapRow · #zqfe74lx · component · runs in the browser

handles onPress

A line of #kspzigyu's lists: what it names (a button, if it can be picked), and a count.

import type { ReactNode } from "react";
import { Button } from "react-aria-components";

export function CodeMapRow({
  onPick,
  children,
  count,
}: {
  onPick?: () => void;
  children: ReactNode;
  count?: ReactNode;
}) {
  return (
    <li>
      {onPick ? (
        <Button className="cmpick" onPress={onPick}>
          {children}
        </Button>
      ) : (
        <span>{children}</span>
      )}
      {count !== undefined && <span className="muted">{count}</span>}
    </li>
  );
}

used by