Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

551 B
Raw Blame
import { shortcutLabel } from './shortcut-label';

export interface HeldKeys {
  ctrl?: boolean;
  alt?: boolean;
  shift?: boolean;
  meta?: boolean;
}

export function keyCombo(held: HeldKeys, key: string, mac: boolean): string {
  const shown = key.length === 1 ? key.toUpperCase() : key;
  const parts = [
    ...(held.meta ? [mac ? 'Command' : 'Meta'] : []),
    ...(held.ctrl ? ['Ctrl'] : []),
    ...(held.alt ? ['Alt'] : []),
    ...(held.shift ? ['Shift'] : []),
    shown,
  ].join('+');
  return mac ? shortcutLabel(parts, true) : parts;
}