()
| 23 | } |
| 24 | |
| 25 | render() { |
| 26 | const items = this.state.items |
| 27 | |
| 28 | return ( |
| 29 | <Downshift onChange={this.onChange}> |
| 30 | {({ |
| 31 | getToggleButtonProps, |
| 32 | getInputProps, |
| 33 | getItemProps, |
| 34 | getLabelProps, |
| 35 | getRootProps, |
| 36 | getMenuProps, |
| 37 | isOpen, |
| 38 | inputValue, |
| 39 | selectedItem, |
| 40 | highlightedIndex, |
| 41 | }) => { |
| 42 | return ( |
| 43 | <div> |
| 44 | <div {...getRootProps({}, {})}></div> |
| 45 | <label {...getLabelProps()}>Hello:</label> |
| 46 | <label {...getLabelProps()}>Hello:</label> |
| 47 | <input |
| 48 | {...getInputProps({ |
| 49 | placeholder: 'Favorite color ?', |
| 50 | })} |
| 51 | /> |
| 52 | <button {...getToggleButtonProps()} /> |
| 53 | {isOpen ? ( |
| 54 | <div style={{border: '1px solid #ccc'}} {...getMenuProps()}> |
| 55 | {items |
| 56 | .filter( |
| 57 | i => |
| 58 | !inputValue || |
| 59 | i.toLowerCase().includes(inputValue.toLowerCase()), |
| 60 | ) |
| 61 | .map((item, index: number) => ( |
| 62 | <div |
| 63 | {...getItemProps({item, index})} |
| 64 | key={item} |
| 65 | style={{ |
| 66 | backgroundColor: |
| 67 | highlightedIndex === index ? 'gray' : 'white', |
| 68 | fontWeight: selectedItem === item ? 'bold' : 'normal', |
| 69 | }} |
| 70 | > |
| 71 | {item} |
| 72 | </div> |
| 73 | ))} |
| 74 | </div> |
| 75 | ) : null} |
| 76 | </div> |
| 77 | ) |
| 78 | }} |
| 79 | </Downshift> |
| 80 | ) |
| 81 | } |
| 82 | } |
nothing calls this directly
no outgoing calls
no test coverage detected