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

tn-pagination

v1.0.4

Published

A pagination component for reactjs.

Downloads

2

Readme

pagination

Coverage Status npm version

A SEO friendly pagination component for React.

Install

Via NPM

npm install tn-pagination

Usage

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

class MyComponent extends React.Component {
  componentDidMount() {
    // fetch data for the first time render.
  }

  componentWillReceiveProps(nextProps) {
    // fetch data when click the pagination.
  }

  genUrl = (page) => `/page/${page}`;

  render() {
    return (
      <div>
        <h1>Item list</h1>
        ... //list of items
        <Pagination
          pageCount={15}
          pageRangeDisplayed={5}
          page={1}
          genUrl={this.genUrl}
        />
      </div>
    );
  }
}

Props

List of props that can pass into the components.

| Props | Type | Required | Default | Description | |-------|------|----------|---------|-------------| | pageCount | Integer | true | - | Number of total Pages | | pageRangeDisplayed | Integer | true | - | Range that pagination display | | genUrl | Function | true | - | Function for generate url to attach in the pagination link | | page | Integer | false | 1 | Number of current page | | firstLabel | String | false | '\xAB' | Label for the first page button | | previousLabel | String | false | '\u2039' | Label for the previous page button | | nextLabel | String | false | '\u203A' | Label for the next page button | | lastLabel | String | false | '\xBB' | Label for the last page button | | containerClassName | String | false | 'pagination' | Classname of the pagination component | | activeClassName | String | false | 'active' | Classname of the current page button | | pageClassName | String | false | 'page' | Classname of the button excluded first/previous/next/last button | | pageLinkClassName | String | false | 'page-link' | Classname of the link in the button excluded first/previous/next/last button | | firstClassName | String | false | 'first' | Classname of the first button | | firstLinkClassName | String | false | 'first-link' | Classname of the link in the first button | | previousClassName | String | false | 'previous' | Classname of the previous button | | previousLinkClassName | String | false | 'previous-link' | Classname of the link in the previous button | | nextClassName | String | false | 'next' | Classname of the next button | | nextLinkClassName | String | false | 'next-link' | Classname of the link in the next button | | lastClassName | String | false | 'last' | Classname of the last button | | lastLinkClassName | String | false | 'last-link' | Classname of the link in the last button |