forked from vtex-apps/search-result
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowMoreLoaderResult.js
37 lines (31 loc) · 986 Bytes
/
ShowMoreLoaderResult.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from 'react'
import { Button } from 'vtex.styleguide'
import { FormattedMessage } from 'react-intl'
import SearchResult from '../SearchResult'
import { loaderPropTypes } from '../../constants/propTypes'
import searchResult from '../../searchResult.css'
/**
* Search Result Component.
*/
const ShowMoreLoaderResult = props => {
const { products, recordsFiltered, onFetchMore, fetchMoreLoading } = props
return (
<SearchResult {...props}>
<div
className={`${searchResult.buttonShowMore} w-100 flex justify-center`}
>
{!!products && products.length < recordsFiltered && (
<Button
onClick={onFetchMore}
isLoading={fetchMoreLoading}
size="small"
>
<FormattedMessage id="store/search-result.show-more-button" />
</Button>
)}
</div>
</SearchResult>
)
}
ShowMoreLoaderResult.propTypes = loaderPropTypes
export default ShowMoreLoaderResult