import { Keyboard, KeyboardEventCode } from '@vev/utils'; import React from 'react'; import { SilkeIconDefinitions } from '../../icons'; import { BoxDivProps, SilkeBox } from '../silke-box'; import { SilkeIcon } from '../silke-icon'; import styles from './silke-tooltip.scss'; type IconSymbol = keyof typeof SilkeIconDefinitions; function isShortcutIcon(key: string) { return SilkeIconDefinitions[key as IconSymbol] !== undefined; } export const SilkeShortcuts = ({ shortcuts, style, ...rest }: { shortcuts?: KeyboardEventCode[] } & BoxDivProps) => shortcuts ? ( {shortcuts.map((s, i) => ( {Keyboard.getFormatted(s).map((keys, i) => keys .split(' ') .map((f, index) => isShortcutIcon(f) ? ( ) : ( {f} ), ), )} ))} ) : null;