/* * Copyright (c) 2015 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause */ import React, { type FC } from 'react'; import './Shortcut-item.scss'; export interface Props { title: string; hotKey: string[] | string; } const ShortcutItem: FC = ({ title, hotKey }) => { const shortcutComboKeys: string[][] = !Array.isArray(hotKey) ? [hotKey.split('+')] : hotKey.map(element => element.split('+')); return (
{title}
{shortcutComboKeys.map(shortcutKeys => (
{shortcutKeys.map(shortcutKey => ( {shortcutKey} {shortcutKey !== shortcutKeys[shortcutKeys.length - 1] && ( + )} ))}
))}
); }; export default ShortcutItem;