-
-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): add pagination size of topic list (#1109)
relate #1051
- Loading branch information
Showing
8 changed files
with
96 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import './styles.scss'; | ||
|
||
const PageSize = ({ | ||
pageNumber, | ||
totalPageNumber, | ||
currentPageSize, | ||
totalRecords, | ||
ranges = [10, 25, 50, 100, 150, 200], | ||
onChange, | ||
editPageNumber, | ||
showTotalPageNumber = true | ||
}) => { | ||
var pageSizeOptions = []; | ||
var pageSizeOptionsList = []; | ||
ranges.forEach(element => pageSizeOptions[element] = element ); | ||
//if server's pageSize does not belong to ranges, it should be added - when the page is loaded for the first | ||
if(!ranges.includes(currentPageSize)){ | ||
pageSizeOptions[currentPageSize] = currentPageSize; | ||
} | ||
pageSizeOptions.forEach((k) => { | ||
pageSizeOptionsList.push(<option key={k} value={k}>{pageSizeOptions[k]}</option>); | ||
}) | ||
return ( | ||
<div id="result-per-page"> | ||
<span>Results</span> | ||
<select className="pagination mb-0" id="currentPageSize" name="currentPageSize" value={currentPageSize} onChange={(e) => {e.preventDefault(); onChange(pageSizeOptions[e.target.value])}}> | ||
{pageSizeOptionsList} | ||
</select> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PageSize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import PageSize from './PageSize'; | ||
|
||
export default PageSize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@import "../../css/init"; | ||
|
||
// result per page | ||
#result-per-page{ | ||
float: left; | ||
display: flex; | ||
} | ||
#result-per-page span{ | ||
margin: 5px; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters