Giter Site home page Giter Site logo

react-styled-paginate's Introduction

Styled Paginate

기존 페이지네이션 컴포넌트 라이브러리를 사용하면 스타일을 적용할 때 css, className을 이용하거나 라이브러리에서 제공하는 커스터마이징 방식을 따라야 하는 불편함이 있었습니다.

이에 사용자가 직접 커스터마이징한 컴포넌트를 전달하여 페이지네이션을 생성해주는 라이브러리를 구현했습니다.

Install

준비 중입니다.

Usage

// ...
import { Paginate } from '@jakelee/styled-paginate';

const Page = () => {
  const [page, setPage] = useState(1);

  return (
    <>
      <h2>Default</h2>

      <Paginate currentPage={page} total={10} onClickPage={setPage} />

      <h2>Custom Component</h2>

      <Paginate
        currentPage={page}
        total={10}
        onClickPage={setPage}
        options={{
          containerComponent: ({ children }) => {
            return (
              <div
                style={{ display: 'flex', justifyContent: 'start', gap: '4px' }}
              >
                {children}
              </div>
            );
          },
          pageButtonComponent: ({ children, active, ...props }) => {
            return (
              <div
                {...props}
                style={{
                  backgroundColor: active ? 'blue' : 'white',
                  color: active ? 'white' : 'black',
                  cursor: 'pointer',
                  padding: '10px',
                  border: '1px solid black',
                  borderRadius: '5px',
                }}
              >
                {children}
              </div>
            );
          },
        }}
      />
    </>
  );
};

export default Page;

react-styled-paginate's People

Contributors

freejak5520 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.