diff --git a/src/DropdownMenu.tsx b/src/DropdownMenu.tsx index 29a6c15..fe21289 100644 --- a/src/DropdownMenu.tsx +++ b/src/DropdownMenu.tsx @@ -1,6 +1,9 @@ import Menu, { MenuItem } from 'rc-menu'; import * as React from 'react'; -import { MentionsContextConsumer, MentionsContextProps } from './MentionsContext'; +import { + MentionsContextConsumer, + MentionsContextProps, +} from './MentionsContext'; import { OptionProps } from './Option'; interface DropdownMenuProps { @@ -29,36 +32,44 @@ class DropdownMenu extends React.Component { prefixCls={`${prefixCls}-menu`} activeKey={activeOption.key} onSelect={({ key }) => { - const option = options.find(({ key: optionKey }) => optionKey === key); + const option = options.find( + ({ key: optionKey }) => optionKey === key, + ); selectOption(option); }} onFocus={onFocus} onBlur={onBlur} > - {options.map((option, index) => { - const { key, disabled, children, className, style } = option; - return ( - { - setActiveIndex(index); - }} - > - {children} - - ); - })} - - {!options.length && {notFoundContent}} + {options.length ? ( + options.map((option, index) => { + const { key, disabled, children, className, style } = option; + return ( + { + setActiveIndex(index); + }} + > + {children} + + ); + }) + ) : ( + + {notFoundContent || 'Not Found'} + + )} ); }; public render() { - return {this.renderDropdown}; + return ( + {this.renderDropdown} + ); } }