import autobind from "autobind-decorator" ; import * as React from "react" ; import { QuickSelect } from "components/modals" ; import { ICommandPaletteProps } from "props/modals" ; /** The CommandPalette component, a QuickSelect for general commands. */ class CommandPalette extends React . PureComponent < ICommandPaletteProps > { returns public render ( ) { return < QuickSelect isOpen = { this . props . isOpen } onClose = { this . props . onClose } initialItems = { this . renderItems ( ) } onSelect = { this . handleSelect } theme = { this . props . theme } / > ; } returns private renderItems ( ) { const itemKeys = Object . keys ( this . props . applicationCommands ) ; return itemKeys . map ( item => < li id = { item } value = { item } > { item } < /li>); } param selectedItem @ autobind private handleSelect ( selectedItem ) { this . props . applicationCommands [ selectedItem ] ( ) ; } } export default CommandPalette ;