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

simple-navigation-component

v1.0.4

Published

It is a component added with the functions that navigation should have and designed with bootstrap.

Downloads

7

Readme

simple-navigation-component

Build Status npm version

This is a navigation component created with vanilla js (ES6).
Simply pass api and the id value of the html you want to specify as root, and the renderOption to complete the navigation.

Install

$ npm install simple-navigation-component --save-dev
# or
$ yarn add -D simple-navigation-component

Feature

You can see the demo with list component in demo-branch

1. Caching fetched data

Assuming that the data fetched from the api does not change, once fetched from the api, the data corresponding to that index is cached.

2. Prev button and Next button

These two buttons change the index to the first index of the next or previous page. For example, if countOfIndex is 5, if index is between 1 and 5, clicking on the next button will move to the first index of 6 on the next page. (Similarly, if the index is between 6 and 10, click the prev button to move to index of 1.)

3. Activate buttons according to the situation

X: Clickable / O: Not clickable

Case 1

| 이전 | << | >> | 다음 | |:-:|:-:|:-:|:-:| | X | X | O | O |

Case 2

| 이전 | << | >> | 다음 | |:-:|:-:|:-:|:-:| | X | O | O | O |

Case 3

| 이전 | << | >> | 다음 | |:-:|:-:|:-:|:-:| | O | O | O | X |

Case 4

| 이전 | << | >> | 다음 | |:-:|:-:|:-:|:-:| | O | O | X | X |

Usage

const nav = new NavComponent(api, '#nav');
nav.on('buildNav', data => {
    //TODO attach event
});

Also,

const nav = new NavComponent(api, '#nav', {
    countOfItem: 5,
    countOfIndex: 3
});
nav.on('buildNav', data => {
    //TODO attach event
});

Event buildNav occurs when the navigation index changes by click.

Notice!

If the renderOption passed to the two each components is different, an error occurs. You can check it in tool for developer of browser.

// default renderOption
{
  countOfItem: 3, // Number of items to render on one page
  countOfIndex: 5 // Number of pagination about items
}

API Design in component

  • To fetch value to count of data
[Domain Address]/count

Development

# Clone repository and move folder
$ git clone https://github.com/JaeYeopHan/simple-navigation-component
$ cd simple-navigation-component

# Install dependencies
$ yarn
# or
$ npm install

# Build
$ npm run dev

# Test
$ npm test

Supported Browsers

The following table shows browsers supported in this component

|IE|Chrome|Firefox|Safari| |:-:|:-:|:-:|:-:|:-:|:-:| |11+|Latest|Latest|Latest|

Dependency

  • axios
  • handlebars
  • event-emitter
  • bootstrap

Bug Report

If you find a bug, please report it to me using the Issues page on Github

LICENSE

simple-navigation-component is released under the MIT License.

Copyright (c) 2017 Jbee

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.