({item, state})
| 119 | } |
| 120 | |
| 121 | function Option({item, state}) { |
| 122 | let ref = React.useRef(null); |
| 123 | let {optionProps, isSelected, isFocused, isDisabled} = useOption({key: item.key}, state, ref); |
| 124 | |
| 125 | let backgroundColor; |
| 126 | let color = 'black'; |
| 127 | |
| 128 | if (isSelected) { |
| 129 | backgroundColor = 'blueviolet'; |
| 130 | color = 'white'; |
| 131 | } else if (isFocused) { |
| 132 | backgroundColor = 'gray'; |
| 133 | } else if (isDisabled) { |
| 134 | backgroundColor = 'transparent'; |
| 135 | color = 'gray'; |
| 136 | } |
| 137 | |
| 138 | return ( |
| 139 | <li |
| 140 | {...optionProps} |
| 141 | ref={ref} |
| 142 | style={{ |
| 143 | background: backgroundColor, |
| 144 | color: color, |
| 145 | padding: '2px 5px', |
| 146 | outline: 'none', |
| 147 | cursor: 'pointer' |
| 148 | }}> |
| 149 | {item.rendered} |
| 150 | </li> |
| 151 | ); |
| 152 | } |
nothing calls this directly
no test coverage detected