({
itemProps,
result,
isHighlighted,
}: SearchItemProps)
| 216 | }; |
| 217 | |
| 218 | export function SearchItem({ |
| 219 | itemProps, |
| 220 | result, |
| 221 | isHighlighted, |
| 222 | }: SearchItemProps) { |
| 223 | const heroPath = new JSONHeroPath(result.item); |
| 224 | const [json] = useJson(); |
| 225 | |
| 226 | const itemValue = heroPath.first(json); |
| 227 | const ItemIcon = iconForValue(itemValue); |
| 228 | |
| 229 | return ( |
| 230 | <li |
| 231 | {...itemProps} |
| 232 | className={classnames("flex w-full hover:cursor-pointer")} |
| 233 | > |
| 234 | <div |
| 235 | className={classnames( |
| 236 | "w-full h-[calc(100%-4px)] mb-2 rounded-sm group", |
| 237 | isHighlighted ? "bg-indigo-700" : "bg-slate-100 dark:bg-slate-900" |
| 238 | )} |
| 239 | > |
| 240 | <div className="flex items-center w-full py-2 pl-4 pr-3"> |
| 241 | <ItemIcon |
| 242 | className={classnames( |
| 243 | "h-6 w-6", |
| 244 | isHighlighted |
| 245 | ? "text-white" |
| 246 | : "text-slate-500 dark:text-slate-400" |
| 247 | )} |
| 248 | ></ItemIcon> |
| 249 | <div className="flex flex-col ml-3"> |
| 250 | <div className="flex w-full items-baseline"> |
| 251 | <SearchPathResult |
| 252 | path={heroPath} |
| 253 | searchResult={result} |
| 254 | isHighlighted={isHighlighted} |
| 255 | /> |
| 256 | </div> |
| 257 | <div className="key-value flex justify-between"> |
| 258 | {result.score.rawValue && ( |
| 259 | <SearchResultValue |
| 260 | isHighlighted={isHighlighted} |
| 261 | stringValue={result.score.rawValue} |
| 262 | matches={result.score.rawValueMatch} |
| 263 | /> |
| 264 | )} |
| 265 | {result.score.formattedValue && |
| 266 | result.score.formattedValue !== result.score.rawValue && ( |
| 267 | <SearchResultValue |
| 268 | isHighlighted={isHighlighted} |
| 269 | stringValue={result.score.formattedValue} |
| 270 | matches={result.score.formattedValueMatch} |
| 271 | /> |
| 272 | )} |
| 273 | </div> |
| 274 | </div> |
| 275 | </div> |
nothing calls this directly
no test coverage detected