@@ -37,44 +37,49 @@ class StoreDashboard extends React.Component {
3737 render ( ) {
3838 const { pluginsList, searchQuery} = this . state ;
3939 const { getPlugins} = this . props ;
40+
41+ let element = null ;
4042 if ( pluginsList . length <= 0 ) {
41- return ( < p > Loading</ p > )
42- }
43- const filteredList = pluginsList ? pluginsList . filter ( element => {
44- return (
45- element . name . toLowerCase ( ) . includes ( searchQuery ) ||
46- element . description . toLowerCase ( ) . includes ( searchQuery ) ||
47- element . longDescription . toLowerCase ( ) . includes ( searchQuery ) ||
48- element . author . toLowerCase ( ) . includes ( searchQuery )
49- ) ;
50- } ) : [ ] ;
51- return (
52- < div data-test = "storeDashboardComponent" >
53- < Row >
54- < Col lg = { 12 } className = "mb-4 d-flex justify-content-between" >
55- < Button color = "secondary" onClick = { ( ) => this . props . history . goBack ( ) } > Back</ Button >
56- < Form inline onSubmit = { ( e ) => e . preventDefault ( ) } >
57- < InputGroup >
58- < Input placeholder = "Type to start searching" type = "text" value = { searchQuery }
59- onChange = { ( e ) => this . setState ( { searchQuery : e . target . value } ) } />
60- < InputGroupAddon addonType = "append" > < Button color = "primary" > < span
61- className = "fa fa-search" /> </ Button > </ InputGroupAddon >
62- </ InputGroup >
43+ element = ( < p > Loading</ p > ) ;
44+ } else {
45+ const filteredList = pluginsList ? pluginsList . filter ( element => {
46+ return (
47+ element . name . toLowerCase ( ) . includes ( searchQuery ) ||
48+ element . description . toLowerCase ( ) . includes ( searchQuery ) ||
49+ element . longDescription . toLowerCase ( ) . includes ( searchQuery ) ||
50+ element . author . toLowerCase ( ) . includes ( searchQuery )
51+ ) ;
52+ } ) : [ ] ;
53+ element = (
54+ < >
55+ < Row >
56+ < Col lg = { 12 } className = "mb-4 d-flex justify-content-between" >
57+ < Button color = "secondary" onClick = { ( ) => this . props . history . goBack ( ) } > Back</ Button >
58+ < Form inline onSubmit = { ( e ) => e . preventDefault ( ) } >
59+ < InputGroup >
60+ < Input placeholder = "Type to start searching" type = "text" value = { searchQuery }
61+ onChange = { ( e ) => this . setState ( { searchQuery : e . target . value } ) } />
62+ < InputGroupAddon addonType = "append" > < Button color = "primary" > < span
63+ className = "fa fa-search" /> </ Button > </ InputGroupAddon >
64+ </ InputGroup >
6365
6466
65- </ Form >
66- </ Col >
67- </ Row >
68- < Row >
69- {
70- filteredList . map ( ( e ) =>
71- < Col lg = { 6 } key = { e . name } >
72- < PluginPlaceHolderCard plugin = { e } getPlugins = { getPlugins } />
73- </ Col >
74- )
75- }
76- </ Row >
77- </ div > ) ;
67+ </ Form >
68+ </ Col >
69+ </ Row >
70+ < Row >
71+ {
72+ filteredList . map ( ( e ) =>
73+ < Col lg = { 6 } key = { e . name } >
74+ < PluginPlaceHolderCard plugin = { e } getPlugins = { getPlugins } />
75+ </ Col >
76+ )
77+ }
78+ </ Row >
79+ </ >
80+ ) ;
81+ }
82+ return < div data-test = "storeDashboardComponent" > ${ element } </ div >
7883 }
7984}
8085
0 commit comments