0.2.1 • Published 5 years ago

react-js-paginator v0.2.1

Weekly downloads
33
License
MIT
Repository
github
Last release
5 years ago

npm npm npm

React-js-paginator

Simple react JS paginator

Description

Simple React JS Pagination component. Can be easily customized with CSS objects

How it looks

alt text

How to thank me? Just click on ⭐️ button :)

Installation

Install it from npm and include it in your React build process (using Webpack, Browserify, etc).

npm i react-js-paginator

Usage

It is really easy to use, just:

Import Paginator in your react component.

import Paginator from 'react-js-paginator';

And then specify the page size, total elements and a callback function.

For example:

<Paginator
  pageSize={10}
  totalElements={64}
  onPageChangeCallback={(e) => {this.pageChange(e)}}
/>

Once the page has changed, will trigger the callback function and send back the current page.

Styles can be customized using pageBoxStyle and activePageBoxStyle props like:

pageBoxStyle={{
	border: 0, 
	color: 'black', 
	padding: 3, 
	fontSize: 16
}}
activePageBoxStyle={{
	fontWeight: 'bolder', 
	color: 'green', 
	backgroundColor: '#d7f7dc'
}}

Giving you as result:

alt text

Props

NameTypeMandatoryDescription
pageSizeintYHow many elements will compose a page
totalElementsintYTotal elements you have in store
onPageChangeCallbackfunctionYfunction to be triggered when a page change happens
pageBoxStyleobjectNstyle object for each pagination box
activePageBoxStyleobjectNstyle object the active page
maxPagesToDisplayintNhow many pages will be displayed at the same time in the paginator (default 6)
firstArrowAlwaysVisiblepresentNshowAlways the first page arrow
lastArrowAlwaysVisiblepresentNshowAlways the first page arrow
firstArrowSymbolstringNcustomize first page symbol (default <<)
lastArrowSymbolstringNcustomize last page symbol (default >>)

What's new

0.2.0

  • Package size optimized

0.2.0

  • Dependencies updated
  • Overall package size optimized

0.1.10

  • Dependencies updated

0.1.9

  • Proptypes added

0.1.8

  • Background updated to be transparent

0.1.7

  • CSS updated to be isolated under paginator class

0.1.5

  • Typecheck added, minor tweaking and styling changes

0.1.3

  • Bug fixing: last page was not always being showed.

0.1.1

  • Fixed issue where maxPagesToDisplay was showing one more page than the prop number

0.1.0

  • New default style (less ugly)
  • Style customization properties enhanced

0.0.8

  • Added props to force first and last arrows
  • Added props to customize first and last symbols

0.0.6

  • Added functionality to hide arrows if first page or last page is visible

License

Licensed under the MIT License © jciccio

0.2.1

5 years ago

0.2.0

5 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.8

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago