Skip to content

opensea0508/js-paging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-paging

Paging badges generator

Example of paging badges

Getting started

yarn add js-paging

Usage

Demo: https://codesandbox.io/s/js-paging-j4hvd?from-embed

import pageBadges from "js-paging";

// ...

return (
  {pageBadges({ currentPage, pages }).map((num, index) =>
    num ? (
      <button
        key={`page-${num}`}
        type="button"
        onClick={num === currentPage ? undefined : () => onChangePage(num)}
        className={`badge ${num === currentPage ? "current" : ""}`}
      >
        {num}
      </button>
    ) : (
      <span key={`separator-${index}`} className="separator">
        ...
      </span>
    )
  )}
)

About

Paging badges generator

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published