Legacy
CorePagination
페이지네이션 컴포넌트
Usage
기본 사용법 (onPageChange 사용)
import { useState } from 'react';
import { CorePagination } from '@featuring-corp/components';
const [activePage, setActivePage] = useState(1);
<CorePagination
totalPage={30}
activePage={activePage}
onPageChange={setActivePage}
/>개별 이벤트 핸들러 사용
import { CorePagination } from '@featuring-corp/components';
<CorePagination
totalPage={30}
activePage={1}
onPageClick={(e) => {
const page = parseInt(e.currentTarget.textContent || '1');
console.log('페이지 클릭:', page);
}}
onPreviousClick={(e) => {
console.log('이전 페이지 클릭');
}}
onNextClick={(e) => {
console.log('다음 페이지 클릭');
}}
onPreviousGroupClick={(e) => {
console.log('이전 그룹 클릭');
}}
onNextGroupClick={(e) => {
console.log('다음 그룹 클릭');
}}
/>최대 표시 페이지 수 설정
import { useState } from 'react';
import { CorePagination } from '@featuring-corp/components';
const [activePage, setActivePage] = useState(1);
<CorePagination
totalPage={30}
activePage={activePage}
onPageChange={setActivePage}
maxVisible={10}
/>그룹 이동 아이콘 숨기기
import { useState } from 'react';
import { CorePagination } from '@featuring-corp/components';
const [activePage, setActivePage] = useState(1);
<CorePagination
totalPage={30}
activePage={activePage}
onPageChange={setActivePage}
showMoveGroupIcon={false}
/>제어된 컴포넌트 예제
import { useState } from 'react';
import { CorePagination } from '@featuring-corp/components';
const PaginationExample = () => {
const [activePage, setActivePage] = useState(1);
const totalPage = 30;
const handlePageChange = (page: number) => {
setActivePage(page);
// 페이지 변경 시 API 호출 등
console.log('페이지 변경:', page);
};
return (
<CorePagination
totalPage={totalPage}
activePage={activePage}
onPageChange={handlePageChange}
/>
);
};Props
Prop
Type
스타일
기본 스타일 속성
Pagination Group:
display:flex
Pagination Item:
display:flexjustify-content:centerpadding:spacing-150(6px)height:40px
Pagination Inner Item:
display:flexjustify-content:centerpadding-x:spacing-250(10px)border-radius:radius-100height:28pxtransition:0.2sposition:relative
Pagination Icon:
display:flexjustify-content:centerheight:40pxwidth:40pxcursor:pointer
Active State
- Active:
typography: heading[2],color: text-1, 하단에2px높이의primary[60]색상 바 표시 (width:calc(100% - 12px), min-width:16px) - Inactive:
typography: body[2],color: text-3 - Hover:
background-color: primary-10,color: text-1 - Focus:
box-shadow: 0 0 0 2px focus색상
States (상태별 토큰)
Pagination Inner Item:
- Default:
typography: body[2],color: text-3(active: off) - Hover:
background-color: primary-10,color: text-1 - Active:
color: text-1(active: on) - Focus-visible:
box-shadow: 0 0 0 2px focus색상 - Active (on):
typography: heading[2],color: text-1, 하단에2px높이의primary[60]색상 바 표시 (width:calc(100% - 12px), min-width:16px)
Pagination Icon:
- Enabled:
color: icon-primary - Disabled:
color: icon-tertiary - Ellipsis:
color: icon-secondary,cursor: default