1+ /* eslint-disable no-nested-ternary */
12import { useState } from 'react' ;
23import { useQuery } from '@apollo/client' ;
34import { useParams } from 'react-router-dom' ;
@@ -10,6 +11,7 @@ import { PAGE_QUERY_POLL_INTERVAL_IN_MS } from '../lib/constants';
1011import ViewCookbookSnippetsError from '../components/ViewCookbookSnippets/ViewCookbookSnippetsError' ;
1112import ViewCookbookSnippetsLoading from '../components/ViewCookbookSnippets/ViewCookbookSnippetsLoading' ;
1213import ViewCookbookSnippetsEmpty from '../components/ViewCookbookSnippets/ViewCookbookSnippetsEmpty' ;
14+ import ViewCookbookSnippetsEmptyFiltered from '../components/ViewCookbookSnippets/ViewCookbookSnippetsEmptyFiltered' ;
1315import BackButton from '../components/BackButton' ;
1416import FavoriteCookbook from '../components/Favorite/FavoriteCookbook' ;
1517import AvatarAndName from '../components/AvatarAndName' ;
@@ -101,25 +103,28 @@ export default function ViewCookbookSnippets() {
101103
102104 < Flex w = "full" flex = { 1 } justifyContent = "flex-end" >
103105 < Input
104- minWidth = "200px "
106+ minWidth = "100px "
105107 maxWidth = "500px"
106108 justifySelf = "flex-end"
107109 mr = "space_16"
108- placeholder = "Search on this cookbook "
110+ placeholder = "Search"
109111 value = { searchTerm }
110112 onChange = { ( e ) => setSearchTerm ( e . target . value ) }
111113 />
112114 </ Flex >
113115 </ HStack >
114116 ) }
115117
116- { /* eslint-disable-next-line no-nested-ternary */ }
117118 { cookbookSnippetLoading ? (
118119 < SnippetResultsLoading />
119- ) : snippets . length === 0 ? (
120- < ViewCookbookSnippetsEmpty />
121- ) : (
120+ ) : snippets . length > 0 ? (
122121 < SnippetResults results = { snippets } />
122+ ) : searchTerm ? (
123+ < ViewCookbookSnippetsEmptyFiltered
124+ clearSearch = { ( ) => setSearchTerm ( '' ) }
125+ />
126+ ) : (
127+ < ViewCookbookSnippetsEmpty />
123128 ) }
124129 </ Box >
125130 ) ;
0 commit comments