npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

filterable-react-pagination-status

v2.0.1

Published

A fork of react-pagination-status

Downloads

4

Readme

react-pagination-status

Build Status

Known Vulnerabilities

A pagination component of React let you to manage page status.

If you want use react-pagination-status with table component, maybe you can try this

Install

 npm install --save react-pagination-status

Migration

After the version 2.x, the behavior of the className prop will be a little different. For a better way to architect your CSS, the className of the specific components will be more maintainable. Such as the className of the buttons will become {prefixClassName}__btn, and the activated button will be {prefixClassName}__btn--active.

If you want to see more CSS. The example will be helpful to you.

Usage

Demo

import React from 'react';
import Pagination from 'react-pagination-status';

export default class app extends React.Component {

    constructor(props) {
        super(props);
        this.handleChangePage = ::this.handleChangePage;
        //Store activePage state into parent component
        this.state = {
            activePage: 0
        }
    }

    handleChangePage(page) {
        this.setState({
            activePage: page
        })
    }

    render() {
        const { activePage } = this.state;
        return (
            <div>
                <div>now page number: { activePage +1 }</div>
                <Pagination
                    handleChangePage = { this.handleChangePage }
                    activePage = { activePage }
                    totalCount = { 10 }
                    perPageItemCount = { 2 }
                />
            </div>
        )
    }
}

className

The react-pagination-status is the default className and prefix. You can pass custom name with the className prop.

In addition, setting the specific components to the differences styles and status by these className

  • {className}__item(the <li> tags)
  • {className}__btn(the page button)
  • {className}__btn--active(the activated page button)
  • {className}__btn--disable

API

Pagination

| Props | Description | Type | Default | |------------------|------------------------------------|---------------|--------------------------| | handleChangePage | the argument is current page | function | isRequired | | activePage | the activated page | Number | isRequired | | totalCount | the length of the items | Number | isRequired | | perPageItemCount | the numbers of the items on per page | Number | isRequired | | nextPageText | the text of nextPage button | String | 下一頁 | | prePageText | the text of previousPage button | String | 上一頁 | | className | the default className | String | react-pagination-status | | partialPageCount | the numbers of the page buttons | Number | 5 |

Example

npm start

By default, the example is on the 8000 port after run the command above. Then you can access localhost:8000 to see the demo.

Test

npm test

LICENSE

MIT