File tree Expand file tree Collapse file tree 1 file changed +21
-10
lines changed Expand file tree Collapse file tree 1 file changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -77,10 +77,19 @@ export default class TeamList extends Component {
7777 teams
7878 )
7979
80+ // Default empty table message
81+ let emptyTableMessage = 'No teams created yet.'
82+
8083 if ( search ?. length > 0 ) {
84+ // Apply search
8185 rows = rows . filter ( ( r ) =>
8286 r . name . toUpperCase ( ) . includes ( search . toUpperCase ( ) )
8387 )
88+
89+ // Change empty table message when no results are available
90+ if ( rows . length === 0 ) {
91+ emptyTableMessage = 'Search returned no results.'
92+ }
8493 }
8594
8695 // Calculate start and end index
@@ -104,20 +113,22 @@ export default class TeamList extends Component {
104113 onRowClick = { ( row ) => {
105114 Router . push ( join ( URL , `/teams/${ row . id } ` ) )
106115 } }
107- emptyPlaceHolder = { 'No teams created yet.' }
116+ emptyPlaceHolder = { emptyTableMessage }
108117 showRowNumbers
109118 sort = { sortOptions }
110119 setSort = { ( s ) => this . setState ( { sortOptions : s } ) }
111120 />
112- < Pagination
113- data-cy = { `teams-table-pagination` }
114- pagination = { {
115- perPage : DEFAULT_PAGE_SIZE ,
116- total : rows . length ,
117- currentPage : page ,
118- } }
119- setPage = { ( p ) => this . setState ( { page : p } ) }
120- />
121+ { rows ?. length > 0 && (
122+ < Pagination
123+ data-cy = 'teams-table-pagination'
124+ pagination = { {
125+ perPage : DEFAULT_PAGE_SIZE ,
126+ total : rows . length ,
127+ currentPage : page ,
128+ } }
129+ setPage = { ( p ) => this . setState ( { page : p } ) }
130+ />
131+ ) }
121132 </ >
122133 )
123134 }
You can’t perform that action at this time.
0 commit comments