1import type { SnapShotShortcut } from "@t3tools/contracts";
2import { snapShotShortcutKeyLabels } from "../../lib/snapShotShortcut";
3import { Kbd, KbdGroup } from "../ui/kbd";
4
5export function SnapShotShortcutKeys({
6 shortcut,
7 platform = navigator.platform,
8}: {
9 shortcut: SnapShotShortcut;
10 platform?: string;
11}) {
12 const seenLabels = new Map<string, number>();
13 return (
14 <KbdGroup>
15 {snapShotShortcutKeyLabels(shortcut, platform).map((label) => {
16 const seen = seenLabels.get(label) ?? 0;
17 seenLabels.set(label, seen + 1);
18 return (
19 <Kbd aria-hidden key={`${label}-${seen}`}>
20 {label}
21 </Kbd>
22 );
23 })}
24 </KbdGroup>
25 );
26}