Skip to content

Commit

Permalink
feat: No recipes found message (search recipes)
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoRibeiro25 committed Aug 26, 2023
1 parent a7f6412 commit c5473e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/components/NoItemsFound/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ const NoItemsFound: React.FC<NoItemsFoundProps> = ({ warning, message }) => {
fill="#878d98"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
className="w-14 text-primary-text-color dark:text-primary-text-color"
className="w-14 text-primary-text-color"
>
<path d="M4 2v18H3v2h4v-2H6v-5h13a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H6V2H4zm4 3v2h2V5h2v2h2V5h2v2h2v2h-2v2h2v2h-2v-2h-2v2h-2v-2h-2v2H8v-2H6V9h2V7H6V5h2z"></path>
<path d="M8 9h2v2H8zm4 0h2v2h-2zm-2-2h2v2h-2zm4 0h2v2h-2z"></path>
</svg>
<p className="text-primary-text-color dark:text-primary-text-color">{warning}</p>
<p className="text-primary-text-color dark:text-primary-text-color">
{message ?? ''}
</p>
<p className="text-primary-text-color">{warning}</p>
<p className="text-primary-text-color">{message ?? ''}</p>
</div>
</Reveal>
);
Expand Down
8 changes: 8 additions & 0 deletions src/views/Recipes/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import requests from '../../../../api/requests';
import SearchIcon from '../../../../assets/icons/search.svg';
import Input from '../../../../components/Input';
import Loading from '../../../../components/Loading';
import NoItemsFound from '../../../../components/NoItemsFound';
import Reveal from '../../../../components/Reveal';
import { IRecipe } from '../../../../types/types';
import LoadingRecipes from './components/LoadingRecipes';
Expand Down Expand Up @@ -120,6 +121,13 @@ const Search: React.FC = () => {
))}
</div>
)}

{!loading && !recipes && searchInput.trim().length > 3 && (
<NoItemsFound
warning="No recipes found for the given keyword."
message="Try searching for something else."
/>
)}
</div>
);
};
Expand Down

0 comments on commit c5473e0

Please sign in to comment.