import type { HTMLAttributes, PropsWithChildren, ReactNode } from 'react'
import React, { forwardRef } from 'react'
import { useSearch } from '../../hooks'
export interface SearchDropdownProps extends HTMLAttributes {
/**
* ID to find this component in testing tools (e.g.: cypress,
* testing-library, and jest).
*/
testId?: string
children?: ReactNode
loadingLabel?: string
}
const SearchLoading = ({ loadingLabel }: { loadingLabel?: string }) => {
const { inContext, values } = useSearch()
return (
<>
{inContext && values.isLoading && (
{loadingLabel}
)}
>
)
}
const SearchDropdown = forwardRef<
HTMLDivElement,
PropsWithChildren
>(function SearchDropdown(
{ testId = 'fs-search-dropdown', children, loadingLabel, ...otherProps },
ref
) {
return (
)
})
export default SearchDropdown