-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a. Extract pagination logic and apply to download history page; b. Misc Ui Updates (break-words/margin);
- Loading branch information
Showing
10 changed files
with
348 additions
and
142 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,58 @@ | ||
export const MicroChevronLeft = () => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 16 16" | ||
fill="currentColor" | ||
className="size-4" | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M9.78 4.22a.75.75 0 0 1 0 1.06L7.06 8l2.72 2.72a.75.75 0 1 1-1.06 1.06L5.47 8.53a.75.75 0 0 1 0-1.06l3.25-3.25a.75.75 0 0 1 1.06 0Z" | ||
clipRule="evenodd" | ||
/> | ||
</svg> | ||
) | ||
|
||
export const MicroChevronRight = () => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 16 16" | ||
fill="currentColor" | ||
className="size-4" | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M6.22 4.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1 0 1.06l-3.25 3.25a.75.75 0 0 1-1.06-1.06L8.94 8 6.22 5.28a.75.75 0 0 1 0-1.06Z" | ||
clipRule="evenodd" | ||
/> | ||
</svg> | ||
) | ||
|
||
export const MicroArrowDownTray = () => ( | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-4"> | ||
<path d="M8.75 2.75a.75.75 0 0 0-1.5 0v5.69L5.03 6.22a.75.75 0 0 0-1.06 1.06l3.5 3.5a.75.75 0 0 0 1.06 0l3.5-3.5a.75.75 0 0 0-1.06-1.06L8.75 8.44V2.75Z" /> | ||
<path d="M3.5 9.75a.75.75 0 0 0-1.5 0v1.5A2.75 2.75 0 0 0 4.75 14h6.5A2.75 2.75 0 0 0 14 11.25v-1.5a.75.75 0 0 0-1.5 0v1.5c0 .69-.56 1.25-1.25 1.25h-6.5c-.69 0-1.25-.56-1.25-1.25v-1.5Z" /> | ||
</svg> | ||
) | ||
|
||
export const MicroTrash = () => ( | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-4"> | ||
<path | ||
fill-rule="evenodd" | ||
d="M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z" | ||
clip-rule="evenodd" | ||
/> | ||
</svg> | ||
) | ||
|
||
export const MicroArrowTopRight = () => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 16 16" | ||
fill="currentColor" | ||
className="size-4" | ||
> | ||
<path d="M6.22 8.72a.75.75 0 0 0 1.06 1.06l5.22-5.22v1.69a.75.75 0 0 0 1.5 0v-3.5a.75.75 0 0 0-.75-.75h-3.5a.75.75 0 0 0 0 1.5h1.69L6.22 8.72Z" /> | ||
<path d="M3.5 6.75c0-.69.56-1.25 1.25-1.25H7A.75.75 0 0 0 7 4H4.75A2.75 2.75 0 0 0 2 6.75v4.5A2.75 2.75 0 0 0 4.75 14h4.5A2.75 2.75 0 0 0 12 11.25V9a.75.75 0 0 0-1.5 0v2.25c0 .69-.56 1.25-1.25 1.25h-4.5c-.69 0-1.25-.56-1.25-1.25v-4.5Z" /> | ||
</svg> | ||
) |
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,75 @@ | ||
import React from 'react' | ||
import { MicroChevronLeft, MicroChevronRight } from './Icons' | ||
|
||
const Pagination = ({ | ||
currentPage, | ||
totalPages, | ||
onPageChange, | ||
onItemsPerPageChange, | ||
onJumpToPageSubmit, | ||
jumpToPage, | ||
setJumpToPage, | ||
itemsPerPage | ||
}) => ( | ||
<div className="flex justify-between items-center mt-4 w-full max-w-4xl mx-auto text-sm"> | ||
<div className="flex items-center"> | ||
<form onSubmit={onJumpToPageSubmit} className="flex items-center"> | ||
<label htmlFor="jumpToPage" className="mr-2"> | ||
Jump to page: | ||
</label> | ||
<input | ||
type="number" | ||
id="jumpToPage" | ||
min="1" | ||
max={totalPages} | ||
value={jumpToPage} | ||
onChange={(e) => setJumpToPage(e.target.value)} | ||
className="px-2 py-1 border border-gray-300 rounded" | ||
/> | ||
<button type="submit" className="ml-2 px-4 py-2 bg-blue-500 text-white rounded"> | ||
Go | ||
</button> | ||
</form> | ||
</div> | ||
<div className="flex items-center"> | ||
<div> | ||
<label htmlFor="itemsPerPage" className="mr-2"> | ||
Rows per page: | ||
</label> | ||
<select | ||
id="itemsPerPage" | ||
value={itemsPerPage} | ||
onChange={onItemsPerPageChange} | ||
className="px-2 py-1 border border-gray-300 rounded" | ||
> | ||
<option value={10}>10</option> | ||
<option value={20}>20</option> | ||
<option value={50}>50</option> | ||
</select> | ||
</div> | ||
<span className="mx-4"> | ||
Page {currentPage} of {totalPages} | ||
</span> | ||
<div className="mx-2"> | ||
<button | ||
onClick={() => onPageChange(currentPage - 1)} | ||
disabled={currentPage === 1} | ||
className="px-4 py-2 bg-blue-500 text-white rounded disabled:bg-gray-300" | ||
> | ||
<MicroChevronLeft /> | ||
</button> | ||
</div> | ||
<div className="mx-2"> | ||
<button | ||
onClick={() => onPageChange(currentPage + 1)} | ||
disabled={currentPage === totalPages} | ||
className="px-4 py-2 bg-blue-500 text-white rounded disabled:bg-gray-300" | ||
> | ||
<MicroChevronRight /> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
|
||
export default Pagination |
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
Oops, something went wrong.