import React from 'react' import Text from '../components/Text.js' type Props = { /** The key or chord to display (e.g., "ctrl+o", "Enter", "↑/↓") */ shortcut: string /** The action the key performs (e.g., "expand", "select", "navigate") */ action: string /** Whether to wrap the hint in parentheses. Default: false */ parens?: boolean /** Whether to render the shortcut in bold. Default: false */ bold?: boolean } /** * Renders a keyboard shortcut hint like "ctrl+o to expand" or "(tab to toggle)" * * Wrap in for the common dim styling. * * @example * // Simple hint wrapped in dim Text * * * // With parentheses: "(ctrl+o to expand)" * * * // With bold shortcut: "Enter to confirm" (Enter is bold) * * * // Multiple hints with middot separator - use Byline * * * * * * */ export function KeyboardShortcutHint({ shortcut, action, parens = false, bold = false, }: Props): React.ReactNode { const shortcutText = bold ? {shortcut} : shortcut if (parens) { return ( ({shortcutText} to {action}) ) } return ( {shortcutText} to {action} ) }