empty when at end of search

This commit is contained in:
keyan 2022-01-27 14:31:16 -06:00
parent f1fd1f3c9c
commit d22991bc3b
3 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import { Button } from 'react-bootstrap' import { Button } from 'react-bootstrap'
import { useState } from 'react' import { useState } from 'react'
export default function MoreFooter ({ cursor, fetchMore, Skeleton }) { export default function MoreFooter ({ cursor, fetchMore, Skeleton, noMoreText }) {
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
if (loading) { if (loading) {
@ -28,7 +28,7 @@ export default function MoreFooter ({ cursor, fetchMore, Skeleton }) {
) )
} else { } else {
Footer = () => ( Footer = () => (
<div className='text-muted' style={{ fontFamily: 'lightning', fontSize: '2rem', opacity: '0.6' }}>GENISIS</div> <div className='text-muted' style={{ fontFamily: 'lightning', fontSize: '2rem', opacity: '0.6' }}>{noMoreText || 'GENISIS'}</div>
) )
} }

View File

@ -31,6 +31,7 @@ export default function SearchItems ({ variables, items, pins, cursor }) {
</div> </div>
<MoreFooter <MoreFooter
cursor={cursor} fetchMore={fetchMore} cursor={cursor} fetchMore={fetchMore}
noMoreText='EMPTY'
Skeleton={() => <ItemsSkeleton />} Skeleton={() => <ItemsSkeleton />}
/> />
</> </>

View File

@ -8,6 +8,7 @@ export const getServerSideProps = getGetServerSideProps(ITEM_SEARCH, null, null,
export default function Index ({ data: { search: { items, cursor } } }) { export default function Index ({ data: { search: { items, cursor } } }) {
const router = useRouter() const router = useRouter()
return ( return (
<Layout> <Layout>
<SearchItems <SearchItems