Notice
Recent Posts
Recent Comments
Link
미국산 귤
[React] 페이지네이션 본문
태그 맨 앞 S.은 수정해서 사용
import Pagination from "react-js-pagination";
<S.PaginationContainer isDarkMode={isDarkMode}>
<Pagination
clssName="pagination"
activePage={page} // 현재 페이지
itemsCountPerPage={itemsCountPerPage} // 한 페이지당 아이템 수
totalItemsCount={totalItems} // 총 아이템 수
pageRangeDisplayed={5} // paginator의 페이지 범위
prevPageText={"‹"} // "이전"을 나타낼 텍스트
nextPageText={"›"} // "다음"을 나타낼 텍스트
onChange={handlePageChange} // 페이지 변경을 핸들링하는 함수
/>
// 전체 코드
</S.PaginationContainer>
export const PaginationContainer = styled.div`
.pagination {
display: flex;
justify-content: center;
margin-top: 15px;
cursor: pointer;
margin-left: -70px;
}
ul {
list-style: none;
}
ul.pagination li {
width: 30px;
height: 30px;
font-family: "Pretendard Variable";
font-style: normal;
font-weight: 300;
line-height: 24px;
}
ul.pagination li a {
text-decoration: none;
color: ${(props) => (props.isDarkMode ? "#fff" : "#3D3A3A")};
}
ul.pagination li.active a {
color: #a259ff;
font-weight: 500;
}
ul.pagination li.active a:hover {
color: white;
}
ul.pagination li a:hover {
background-color: #a259ff;
border-radius: 10px;
justify-content: center;
align-items: center;
padding: 0px 5px;
}
`;
'React' 카테고리의 다른 글
[React] 리액트로 다크 모드 구현하기 (1) | 2024.09.18 |
---|---|
[React] 페이지 전환 애니메이션 (0) | 2024.09.18 |
[React-Django 연동] 프론트-백 연동 시 쟝고 서버 실행 방법 (4) | 2024.07.14 |
[Github] 깃허브에서 특정 브랜치 React 프로젝트 다운 받아서 실행시키기 (0) | 2024.06.21 |
[React] 피그마(Figma) 디자인 리액트로 불러오는 방법 (0) | 2024.06.10 |