// noinspection TypeScriptMissingConfigOption import { KBarPortal, KBarSearch, KBarAnimator, KBarPositioner, KBarResults, useMatches, Action, useRegisterActions, } from '@shipixen/kbar' export const KBarModal = ({ actions, isLoading, loadingLabel, noResultsLabel, searchLabel, positionerClassName, containerClassName, searchClassName, }: { actions: Action[] isLoading: boolean loadingLabel: string noResultsLabel: string searchLabel: string positionerClassName?: string containerClassName?: string searchClassName?: string }) => { useRegisterActions(actions, [actions]) return ( ESC {!isLoading && } {isLoading && ( {loadingLabel} )} ) } const RenderResults = ({ noResultsLabel }: { noResultsLabel: string }) => { const { results } = useMatches() if (results.length) { return ( ( {typeof item === 'string' ? ( {item} ) : ( {item.icon && {item.icon}} {item.subtitle && ( {item.subtitle} )} {item.name} {item.shortcut?.length ? ( {item.shortcut.map((sc) => ( {sc} ))} ) : null} )} )} /> ) } else { return ( {noResultsLabel} ) } }