@@ -13,19 +13,19 @@ import {
13
13
AlertList ,
14
14
AlertType ,
15
15
BaseHeader ,
16
- CardListSwitcher ,
17
16
CollectionCard ,
18
- CollectionFilter ,
19
17
CollectionListItem ,
20
18
CollectionNextPageCard ,
21
19
DeleteCollectionModal ,
22
20
EmptyStateFilter ,
23
21
EmptyStateNoData ,
22
+ HubListToolbar ,
24
23
ImportModal ,
25
24
LoadingPageSpinner ,
26
25
Pagination ,
27
26
StatefulDropdown ,
28
27
closeAlertMixin ,
28
+ collectionFilter ,
29
29
} from 'src/components' ;
30
30
import { Constants } from 'src/constants' ;
31
31
import { AppContext } from 'src/loaders/app-context' ;
@@ -157,6 +157,8 @@ class Search extends React.Component<RouteProps, IState> {
157
157
? null
158
158
: deleteCollection ?. repository ?. name ;
159
159
160
+ const ignoredParams = [ 'page' , 'page_size' , 'sort' , 'view_type' ] ;
161
+
160
162
return (
161
163
< div className = 'search-page' >
162
164
< AlertList
@@ -205,48 +207,20 @@ class Search extends React.Component<RouteProps, IState> {
205
207
namespace = { updateCollection . collection_version . namespace }
206
208
/>
207
209
) }
208
- < BaseHeader className = 'hub-header-bordered' title = { t `Collections` } >
209
- { ! noData && (
210
- < div >
211
- < div className = 'hub-toolbar hub-toolbar-left' >
212
- < CollectionFilter
213
- ignoredParams = { [ 'page' , 'page_size' , 'sort' , 'view_type' ] }
214
- params = { params }
215
- updateParams = { updateParams }
216
- />
217
-
218
- < div className = 'hub-pagination-container' >
219
- < div className = 'card-list-switcher' >
220
- < CardListSwitcher
221
- size = 'sm'
222
- params = { params }
223
- updateParams = { ( p ) =>
224
- this . updateParams ( p , ( ) =>
225
- // Note, we have to use this.state.params instead
226
- // of params in the callback because the callback
227
- // executes before the page can re-run render
228
- // which means params doesn't contain the most
229
- // up to date state
230
- localStorage . setItem (
231
- Constants . SEARCH_VIEW_TYPE_LOCAL_KEY ,
232
- this . state . params . view_type ,
233
- ) ,
234
- )
235
- }
236
- />
237
- </ div >
238
-
239
- < Pagination
240
- params = { params }
241
- updateParams = { updateParams }
242
- count = { count }
243
- isTop
244
- />
245
- </ div >
246
- </ div >
247
- </ div >
248
- ) }
249
- </ BaseHeader >
210
+ < BaseHeader className = 'hub-header-bordered' title = { t `Collections` } />
211
+ { ! noData && (
212
+ < HubListToolbar
213
+ count = { count }
214
+ ignoredParams = { ignoredParams }
215
+ params = { params }
216
+ switcher = { Constants . SEARCH_VIEW_TYPE_LOCAL_KEY }
217
+ updateParams = { updateParams }
218
+ { ...collectionFilter ( {
219
+ featureFlags : this . context . featureFlags ,
220
+ ignoredParams,
221
+ } ) }
222
+ />
223
+ ) }
250
224
{ loading ? (
251
225
< LoadingPageSpinner />
252
226
) : noData ? (
@@ -255,7 +229,7 @@ class Search extends React.Component<RouteProps, IState> {
255
229
description = { t `Collections will appear once uploaded` }
256
230
/>
257
231
) : (
258
- < React . Fragment >
232
+ < >
259
233
< section className = 'collection-container' >
260
234
{ this . renderCollections ( collections , {
261
235
count,
@@ -270,7 +244,7 @@ class Search extends React.Component<RouteProps, IState> {
270
244
count = { count }
271
245
/>
272
246
</ section >
273
- </ React . Fragment >
247
+ </ >
274
248
) }
275
249
</ div >
276
250
) ;
0 commit comments