1.0.15 • Published 2 years ago

sweetpagination v1.0.15

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Sweet Pagination

A ReactJS component to render a pagination.

By installing this component and writing only a little bit of code you can obtain this:

Some Styles

Installation

Install Sweet Pagination with npm:

npm i sweetpagination --save

Basic Usage

import React, { useState } from "react";
import SweetPagination from "sweetpagination";

function Items() {
  const [currentPageData, setCurrentPageData] = useState(new Array(2).fill());
  // Example items, to simulate fetching from another resources.
  const items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
  return (
    <div>
      {currentPageData.map((item) => (
        <div>
          <h3>Item #{item}</h3>
        </div>
      ))}

      <SweetPagination
        currentPageData={setCurrentPageData}
        getData={items}
      />
    </div>
  );
}

Change Per-Page Data

If you want, you can show the data as you wish on the page then follow the code below.

Add this props dataPerPage={10} remember props type always Number.

      <SweetPagination
        currentPageData={setCurrentPageData}
        getData={items}
        dataPerPage={10}
      />

Add Navigation

If you want to add navigation button then follow the code below. Add this props navigation={true} remember props type always Boolean.

      <SweetPagination
        currentPageData={setCurrentPageData}
        getData={items}
        dataPerPage={10}
        navigation={true}
      />

Add Pre Loaded Style

If you want, you can add the pre loaded style then follow the code below. Add this props getStyle={'style-1'} remember props type always String.

      <SweetPagination
        currentPageData={setCurrentPageData}
        getData={items}
        dataPerPage={10}
        navigation={true}
        getStyle={'style-1'}
      />

Available Pre-Loaded Style List

Added You Custom Style

If you want, you can add your custom style then follow the code below. Add this props getStyle={'style-custom'} remember props type always String.

      <SweetPagination
        currentPageData={setCurrentPageData}
        getData={items}
        dataPerPage={10}
        navigation={true}
        getStyle={'style-custom'}
      />

Add CSS

    .style-custom{
      //add your coustom code here
    }

Copyright © All rights reserved by Jahidul Islam Zim

1.0.15

2 years ago

1.0.143

2 years ago

1.0.142

2 years ago

1.0.141

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.1

2 years ago

0.1.543

2 years ago

0.1.542

2 years ago

0.1.541

2 years ago

0.1.54

2 years ago

0.1.53

2 years ago

0.1.52

2 years ago

0.1.51

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.33

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago