This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

coffeekraken-s-pagination-component

1.0.1 • Public • Published

Coffeekraken s-pagination-component

Create simple and complexe pagination easily with this webcomponent

View demo

Table of content

  1. Demo
  2. Install
  3. Get Started
  4. Listen for changes
  5. Javascript API
  6. SASS API
  7. Sugar Web Components Documentation
  8. Browsers support
  9. Code linting
  10. Contribute
  11. Who are Coffeekraken?
  12. Licence

Install

npm install coffeekraken-s-pagination-component --save

Get Started

First, import the component into your javascript file like so:

import SPaginationComponent from "coffeekraken-s-pagination-component"

Then simply use it inside your html like so:

<s-pagination
  pages="50"
  current="10"
  limit="5"
  href="/comments/%d"
></s-pagination>

Optionally you can generate a base css for your pagination like so:

@import "node_modules/coffeekraken-s-pagination-component/index";
@include s-pagination-classes($colors: default primary secondary);

This use the sugar colors system

Listen for changes

This component has two "modes". The first is the one where you define an href property. By doing this, each links in the pagination will be plain old html links. Here's an example:

<s-pagination
  pages="50"
  current="10"
  limit="5"
  href="/comments/%d"
></s-pagination>

In this example, each links would be something like so:

  • comments/1
  • comments/2
  • comments/3
  • comments/4
  • etc...

The second mode is when you do not define an href property. You have then two ways to listen for changes in the pagination component. Here's how:

Using addEventListener

$pagination.addEventListener("change", e => {
  // e.detail.newPage
  // e.detail.previousPage
  // do whatever you need to here...
})

Using onchange property

$pagination.setProp({
  onchange: (newPage, previousPage) => {
    // do whatever you need to here...
  }
})

Browsers support

IE / EdgeIE / Edge FirefoxFirefox ChromeChrome SafariSafari
*IE11+ last 2 versions last 2 versions last 2 versions
  • This component use the Proxy feature that is not natively supported by IE11. You'll need to load a polyfill in order to make it work properly.

As browsers are automatically updated, we will keep as reference the last two versions of each but this component can work on older ones as well.

The webcomponent API (custom elements, shadowDOM, etc...) is not supported in some older browsers like IE10, etc... In order to make them work, you will need to integrate the corresponding polyfill.

Code linting

This package uses some code linting rules. Here's the list:

  1. StandardJS for javascript files
  2. Stylelint with stylelint-config-standard for scss files

Your commits will not been accepted if the code style is not respected!

Contribute

This is an open source project and will ever be! You are more that welcomed to contribute to his development and make it more awesome every day. To do so, you have several possibilities:

  1. Share the love ❤️
  2. Declare issues
  3. Fix issues
  4. Add features
  5. Build web component

Who are Coffeekraken

We try to be some cool guys that build some cool tools to make our (and yours hopefully) every day life better.

License

The code is available under the MIT license. This mean that you can use, modify, or do whatever you want with it. This mean also that it is shipped to you for free, so don't be a hater and if you find some issues, etc... feel free to contribute instead of sharing your frustrations on social networks like an asshole...

Package Sidebar

Install

npm i coffeekraken-s-pagination-component

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

1.12 MB

Total Files

32

Last publish

Collaborators

  • olivierbossel