refactor: 페이징 표시 정리

main
minuk926 3 years ago
parent ae4fabf4dd
commit 62d7b80125

@ -12,33 +12,39 @@ const CustomPagination = ({ totalCount, pageSize }) => {
return ( return (
<Grid sx={{ padding: '10px', display: 'flex', justifyContent: 'center' }}> <Grid sx={{ padding: '10px', display: 'flex', justifyContent: 'center' }}>
<Pagination {pageCount > 1 && (
// sx={(theme) => ({ padding: theme.spacing(1.5, 0) })} <Pagination
color="primary" // sx={(theme) => ({ padding: theme.spacing(1.5, 0) })}
variant="outlined" color="primary"
shape="rounded" variant="outlined"
size="small" shape="rounded"
showFirstButton size="small"
showLastButton showFirstButton
count={pageCount} showLastButton
page={page + 1} count={pageCount}
boundaryCount={5} page={page + 1}
siblingCount={2} boundaryCount={5}
pagesize={10} siblingCount={2}
onChange={(event, value) => { pagesize={10}
apiRef.current.setPage(value - 1); onChange={(event, value) => {
}} apiRef.current.setPage(value - 1);
/> }}
<FiberManualRecordIcon />
fontSize="small" )}
sx={{ {pageCount > 1 && (
ml: 2, <FiberManualRecordIcon
mr: 0.5, fontSize="small"
color: '#4caf50' sx={{
}} ml: 2,
/> mr: 0.5,
<Typography variant="h5" color="inherit"> color: '#4caf50'
{page * pageSize + 1} / {totalCount} }}
/>
)}
<Typography variant="span" color="inherit">
{/* 전체 {totalCount} 건 현재페이지 {pageCount > 1 ? `${page * pageSize + 1} / ${totalCount} 건` : `${totalCount}`} */}
{totalCount > 0 ? `전체 ${totalCount}` : ``}
{pageCount > 1 ? `[ ${page + 1} / ${pageCount} ]` : ``}
</Typography> </Typography>
</Grid> </Grid>
); );

Loading…
Cancel
Save