File tree Expand file tree Collapse file tree 1 file changed +28
-23
lines changed Expand file tree Collapse file tree 1 file changed +28
-23
lines changed Original file line number Diff line number Diff line change @@ -147,34 +147,39 @@ const ResultListCard = compose(
147
147
)
148
148
) ( RawResultListCard ) ;
149
149
150
+ const ResultListContainer = ( {
151
+ hideLoading,
152
+ isFetching,
153
+ classes,
154
+ children = null
155
+ } ) => (
156
+ < div className = { classes . root } >
157
+ < Pagination />
158
+ { ! hideLoading && (
159
+ < div className = { classes . loadingContainer } >
160
+ { isFetching && < LinearProgress /> }
161
+ </ div >
162
+ ) }
163
+ { children }
164
+ < Pagination />
165
+ </ div >
166
+ ) ;
167
+
150
168
export class ResultList extends Component {
151
169
render ( ) {
152
- const { items, isFetching, hideLoading, classes } = this . props ;
153
- if ( isFetching && hideLoading ) return null ;
154
- if ( isFetching && ( ! items || isEmpty ( items ) ) ) {
155
- return (
156
- < div className = { classes . loadingContainer } >
157
- < LinearProgress />
158
- </ div >
159
- ) ;
160
- }
161
- if ( ! items || ! Array . isArray ( items ) ) return null ;
170
+ const { items } = this . props ;
171
+
172
+ if ( ! items || ! Array . isArray ( items ) || isEmpty ( items ) )
173
+ return < ResultListContainer { ...this . props } /> ;
174
+
162
175
return (
163
- < div className = { classes . root } >
164
- { ! hideLoading && (
165
- < div className = { classes . loadingContainer } >
166
- { isFetching && < LinearProgress /> }
167
- </ div >
168
- ) }
176
+ < ResultListContainer { ...this . props } >
169
177
< div >
170
- { items
171
- . slice ( 0 , 1 )
172
- . map ( ( item , index ) => (
173
- < ResultListCard key = { item . id || index } item = { item } />
174
- ) ) }
178
+ { items . map ( ( item , index ) => (
179
+ < ResultListCard key = { item . id || index } item = { item } />
180
+ ) ) }
175
181
</ div >
176
- < Pagination />
177
- </ div >
182
+ </ ResultListContainer >
178
183
) ;
179
184
}
180
185
}
You can’t perform that action at this time.
0 commit comments