parent
5be0852080
commit
88c0fd870f
5 changed files with 147 additions and 73 deletions
@ -0,0 +1,20 @@ |
|||||||
|
import React from "react"; |
||||||
|
|
||||||
|
export const GoToPage = ({ pageIndex, gotoPage, pageOptions }) => { |
||||||
|
return ( |
||||||
|
<span className="text-xs text-blue-400"> |
||||||
|
صفحه{" "} |
||||||
|
<input |
||||||
|
className="ml-1 text-xs p-1 rounded border-blue-400" |
||||||
|
type="number" |
||||||
|
defaultValue={pageIndex + 1} |
||||||
|
onChange={(e) => { |
||||||
|
const pageNumber = e.target.value ? Number(e.target.value) - 1 : 0; |
||||||
|
gotoPage(pageNumber); |
||||||
|
}} |
||||||
|
style={{ width: "50px" }} |
||||||
|
/> |
||||||
|
از {pageOptions.length} |
||||||
|
</span> |
||||||
|
); |
||||||
|
}; |
@ -0,0 +1,50 @@ |
|||||||
|
import React from "react"; |
||||||
|
import dobleLeftArrow from "./double-left-arrow.svg"; |
||||||
|
import leftArrow from "./left-arrow.svg"; |
||||||
|
import rightArrow from "./right-arrow.svg"; |
||||||
|
|
||||||
|
export const Pagination = ({ |
||||||
|
gotoPage, |
||||||
|
canPreviousPage, |
||||||
|
previousPage, |
||||||
|
canNextPage, |
||||||
|
pageCount, |
||||||
|
nextPage, |
||||||
|
}) => { |
||||||
|
return ( |
||||||
|
<div className="flex flex-row items-center"> |
||||||
|
<button |
||||||
|
className="rounded py-1 px-2 mx-1 text-xs font-bold" |
||||||
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
||||||
|
onClick={() => gotoPage(0)} |
||||||
|
disabled={!canPreviousPage} |
||||||
|
> |
||||||
|
<img src={dobleLeftArrow} className="rotate-180 w-4 h-4" /> |
||||||
|
</button> |
||||||
|
<button |
||||||
|
className="rounded py-1 px-2 mx-1 text-xs font-bold" |
||||||
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
||||||
|
onClick={() => previousPage()} |
||||||
|
disabled={!canPreviousPage} |
||||||
|
> |
||||||
|
<img src={rightArrow} className="w-3 h-3" /> |
||||||
|
</button> |
||||||
|
<button |
||||||
|
className="rounded py-1 px-2 mx-1 text-xs font-bold" |
||||||
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
||||||
|
onClick={() => nextPage()} |
||||||
|
disabled={!canNextPage} |
||||||
|
> |
||||||
|
<img src={leftArrow} className="w-3 h-3" /> |
||||||
|
</button> |
||||||
|
<button |
||||||
|
className="rounded py-1 px-2 mx-1 text-xs font-bold" |
||||||
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
||||||
|
onClick={() => gotoPage(pageCount - 1)} |
||||||
|
disabled={!canNextPage} |
||||||
|
> |
||||||
|
<img src={dobleLeftArrow} className="w-4 h-4" /> |
||||||
|
</button> |
||||||
|
</div> |
||||||
|
); |
||||||
|
}; |
Loading…
Reference in new issue