All Projects → makotot → paginated

makotot / paginated

Licence: MIT license
⚛️ React render props component & custom hook for pagination.

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to paginated

React Paginating
Simple, lightweight, flexible pagination ReactJS component ⏮⏪1️⃣2️⃣3️⃣⏩⏭
Stars: ✭ 89 (+345%)
Mutual labels:  pagination, render-props
MMM-page-indicator
MagicMirror² module to display what page you're on.
Stars: ✭ 33 (+65%)
Mutual labels:  pagination
render-props
㸚 Easy-to-use React state containers which utilize the render props (function as child) pattern
Stars: ✭ 33 (+65%)
Mutual labels:  render-props
continuation-token
A library for fast, reliable and stateless Web API pagination with Continuation Tokens.
Stars: ✭ 17 (-15%)
Mutual labels:  pagination
beer-app
🍺 Example App - Paginate API response with BLoC in Flutter
Stars: ✭ 20 (+0%)
Mutual labels:  pagination
data
Data providers
Stars: ✭ 31 (+55%)
Mutual labels:  pagination
blogging-app-with-Angular-CloudFirestore
A blogging application created with the help of Angular on front-end and Google Cloud Firestore on backend.
Stars: ✭ 45 (+125%)
Mutual labels:  pagination
theleakycauldronblog
My Personal Blog. Powered by Gatsby and Netlify CMS
Stars: ✭ 33 (+65%)
Mutual labels:  pagination
PagedLists
Paginated UITableView and UICollectionViews for iOS.
Stars: ✭ 69 (+245%)
Mutual labels:  pagination
roove
Dating app based on firebase services and facebook login. MVVM-Kotlin-RxJava-Dagger-Databinding
Stars: ✭ 55 (+175%)
Mutual labels:  pagination
redebounce
↘️ Render Props component to debounce the given value
Stars: ✭ 14 (-30%)
Mutual labels:  render-props
11r
America's favorite Eleventy blog template.
Stars: ✭ 135 (+575%)
Mutual labels:  pagination
EasyDataTable
易用和全面的纯Ajax分页插件(中文)
Stars: ✭ 18 (-10%)
Mutual labels:  pagination
materialui-pagination
A simple pagination component for Material UI.
Stars: ✭ 31 (+55%)
Mutual labels:  pagination
loopback-row-count-mixin
A loopback mixin to get total count of a model
Stars: ✭ 13 (-35%)
Mutual labels:  pagination
reason-epitath
CPS sugar usage for React Render Props composition in ReasonML
Stars: ✭ 16 (-20%)
Mutual labels:  render-props
repository
[PHP 7] Implementation and definition of a base Repository in Domain land.
Stars: ✭ 26 (+30%)
Mutual labels:  pagination
gorm-paginator
gorm pagination extension
Stars: ✭ 154 (+670%)
Mutual labels:  pagination
PetkoparaCrudGeneratorBundle
Symfony3 CRUD generator bundle with pagination, filter, bulk actions and Twitter bootstrap 3.3.6 features.
Stars: ✭ 69 (+245%)
Mutual labels:  pagination
react-save-localstorage
🗄 React component to save data to localStorage on render phase safely
Stars: ✭ 26 (+30%)
Mutual labels:  render-props

DEPRECATED - no longer actively maintained.

Please use GhostUI instead.

Paginated CI

npm NPM npm bundle size npm bundle size GitHub contributors semantic-release

React render props & custom hook for pagination.

Features

Install

npm i @makotot/paginated

Example

Usage

Render Props

import { Paginated } from '@makotot/paginated'

...

return (
  <Paginated currentPage={1} totalPage={10} siblingsSize={2} boundarySize={2}>
    {({ pages, currentPage, hasPrev, hasNext, getFirstBoundary, getLastBoundary, isPrevTruncated, isNextTruncated }) => (
      <div>
        {hasPrev() && <a href="#">prev</a>}
        {getFirstBoundary().map(boundary => <a href="#" key={boundary}>{boundary}</a>)}
        {isPrevTruncated && <span>...</span>}
        {pages.map(page => {
          return page === currentPage ? (
            <span key={page}>{page}</span>
          ) : (
            <a href="#" key={page}>{page}</a>
          );
        })}
        {isNextTruncated && <span>...</span>}
        {getLastBoundary().map(boundary => <a href="#" key={boundary}>{boundary}</a>)}
        {hasNext() && <a href="#">next</a>}
      </div>
    )}
  </Paginated>
)

Hooks

import { usePaginated } from '@makotot/paginated'

...

const { pages, currentPage, hasPrev, hasNext, getFirstBoundary, getLastBoundary, isPrevTruncated, isNextTruncated } = usePaginated({ currentPage: 1, totalPage: 10, siblingsSize: 2, boundarySize: 2 });

return (
  <div>
    {hasPrev() && <a href="#">prev</a>}
    {getFirstBoundary().map(boundary => <a href="#" key={boundary}>{boundary}</a>)}
    {isPrevTruncated && <span>...</span>}
    {pages.map(page => {
      return page === currentPage ? (
        <span key={page}>{page}</span>
      ) : (
        <a href="#" key={page}>{page}</a>
      );
    })}
    {isNextTruncated && <span>...</span>}
    {getLastBoundary().map(boundary => <a href="#" key={boundary}>{boundary}</a>)}
    {hasNext() && <a href="#">next</a>}
  </div>
)

Options

currentPage

Type: number

The value of current page. Required.

totalPage

Type: number

The value of total page. Required.

siblingsSize

Type: number

The items size of one side of the middle of pagination.

boundarySize

Type: number

The items size of one side of the edge of pagination.

Returns (Hooks) | Props (Render Props)

pages

Type: number[]

The page items of the middle of pagination.

currentPage

Type: number

The value of current page.

hasPrev

Type: boolean

Returns true if previous page of the current page is exist.

hasNext

Type: boolean

Returns true if next page of the current page is exist.

getFirstBoundary

Type: () => number[]

Returns page items of first boundary.

getLastBoundary

Type: () => number[]

Returns page items of last boundary.

isPrevTruncated

Type: boolean

Returns true if pages before the current page is ellipsized.

isNextTruncated

Type: boolean

Returns true if pages after the current page is ellipsized.

Authors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].