export default function SearchState({
loading,
error,
total,
retry,
scope,
countLabel,
}: {
loading: boolean;
error?: string;
total: number;
retry: () => void;
scope?: string;
countLabel?: string;
}) {
return (
{scope && {scope}: }
{loading ? (
'A pesquisar…'
) : error ? (
<>
Não foi possível concluir a pesquisa.{' '}
>
) : total === 0 ? (
scope ? (
'Nenhuma opção encontrada'
) : (
'Não foram encontrados resultados para esta pesquisa'
)
) : countLabel ? (
`${total} ${countLabel}`
) : scope ? (
`${total} ${total === 1 ? 'opção disponível' : 'opções disponíveis'}`
) : (
`${total} ${total === 1 ? 'resultado encontrado' : 'resultados encontrados'}`
)}
);
}