import React from 'react' import { forwardRef } from 'react' import type { HTMLAttributes } from 'react' import { List, useSearch } from '../../' export interface SearchTopProps extends HTMLAttributes { /** * ID to find this component in testing tools (e.g.: cypress, testing library, and jest). */ testId?: string /** * Title attribute for the
tag rendered by this component. */ title: string } const SearchTop = forwardRef(function SearchTop( { testId = 'fs-top-search', title = 'Top Search', children, ...otherProps }, ref ) { const { inContext, values } = useSearch() if (inContext && (values.term.length !== 0 || values.isLoading)) { return null } return (

{title}

{children}
) }) export default SearchTop