({item, state})
| 150 | } |
| 151 | |
| 152 | function Option({item, state}) { |
| 153 | let ref = React.useRef<HTMLLIElement | null>(null); |
| 154 | let {optionProps, isSelected, isFocused, isDisabled} = useOption({key: item.key}, state, ref); |
| 155 | |
| 156 | let backgroundColor; |
| 157 | let color = 'black'; |
| 158 | |
| 159 | if (isSelected) { |
| 160 | backgroundColor = 'blueviolet'; |
| 161 | color = 'white'; |
| 162 | } else if (isFocused) { |
| 163 | backgroundColor = 'gray'; |
| 164 | } else if (isDisabled) { |
| 165 | backgroundColor = 'transparent'; |
| 166 | color = 'gray'; |
| 167 | } |
| 168 | |
| 169 | return ( |
| 170 | <li |
| 171 | {...optionProps} |
| 172 | ref={ref} |
| 173 | style={{ |
| 174 | background: backgroundColor, |
| 175 | color: color, |
| 176 | padding: '2px 5px', |
| 177 | outline: 'none', |
| 178 | cursor: 'pointer' |
| 179 | }}> |
| 180 | {item.rendered} |
| 181 | </li> |
| 182 | ); |
| 183 | } |
nothing calls this directly
no test coverage detected