Last active
October 19, 2023 14:11
-
-
Save anthonyk1225/73e5547d55c3c9c2450fac7daa667e31 to your computer and use it in GitHub Desktop.
Styling for react-paginate`'s first example in documentation
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
import React, { useState } from 'react'; | |
import ReactPaginate from 'react-paginate'; | |
import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos'; | |
import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos'; | |
import './pagination.css'; | |
function App() { | |
const [pageCount, setPageCount] = useState(1); | |
const itemsLoaded = ({ | |
limit, | |
skip, | |
total, | |
total_pages, | |
data | |
}) => { | |
setPageCount(total_pages); | |
} | |
return ( | |
<div | |
style={{ | |
display: 'flex', | |
flexDirection: 'column', | |
justifyContent: 'center', | |
padding: 20, | |
boxSizing: 'border-box', | |
width: '100%', | |
height: '100%', | |
}} | |
> | |
<ReactPaginate | |
activeClassName={'item active '} | |
breakClassName={'item break-me '} | |
breakLabel={'...'} | |
containerClassName={'pagination'} | |
disabledClassName={'disabled-page'} | |
marginPagesDisplayed={2} | |
nextClassName={"item next "} | |
nextLabel={<ArrowForwardIosIcon style={{ fontSize: 18, width: 150 }} />} | |
onPageChange={() => null} | |
pageCount={pageCount} | |
pageClassName={'item pagination-page '} | |
pageRangeDisplayed={2} | |
previousClassName={"item previous"} | |
previousLabel={<ArrowBackIosIcon style={{ fontSize: 18, width: 150 }} />} | |
/> | |
</div> | |
); | |
} | |
export default App; |
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
/* .item must be first */ | |
.item { | |
align-items: center; | |
color: #FFF; | |
cursor: pointer; | |
display: flex; | |
font-size: 14px; | |
height: 40px; | |
justify-content: center; | |
width: 40px; | |
} | |
.disabled-page { | |
color: #808e9b; | |
} | |
.active { | |
border: solid 1px #808e9b; | |
border-radius: 40px; | |
color: #808e9b; | |
} | |
.break-me { | |
} | |
.next { | |
border-left: solid 1px #808e9b; | |
font-size: 4px; | |
height: 60px; | |
position: absolute; | |
right: 0; | |
width: 150px; | |
} | |
.pagination { | |
align-items: center; | |
background-color: #0fbcf9; | |
display: flex; | |
flex-direction: row; | |
height: 60px; | |
justify-content: center; | |
list-style-type: none; | |
position: relative; | |
width: 1000px; | |
} | |
.pagination-page { | |
font-weight: 700; | |
} | |
.previous { | |
border-right: solid 1px #808e9b; | |
font-size: 4px; | |
height: 60px; | |
left: 0; | |
position: absolute; | |
width: 150px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice but looks bland!