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

scroll-pilot

v1.0.6

Published

A simple React.js library that improves the accessibility of a web page. It includes a scroll indicator that tracks the user's scrolling progress and provides easy navigation options for moving between sections.

Downloads

23

Readme

ScrollPilot : Scroll Nav & Indicator

ScrollPilot is a React.js library designed to enhance web page accessibility. It provides a scroll indicator that visualizes how much a user has scrolled and offers easy navigation options for moving between sections on a web page.

MIT License

Features

  • Scroll Indicator: A visual representation of the user's scrolling progress.
  • Section Navigation: Easily navigate between different sections of a web page.
  • Customization: Customize the component to match your website's design and requirements.
  • Built on React.js and Material-UI: Utilizes the power of React.js and Material-UI for seamless integration into your web projects.

Demo

Live Demo [Stackblitz]

Installation

You can install the ScrollPilot library using npm:

npm i scroll-pilot

How to use ?

Simply import the ScrollPilot from ScrollPilot

import { ScrollPilot } from 'scroll-pilot';

function App() {
  return (
    <div>
      {/* Your content here */}
      <ScrollPilot />
      {/* More content */}
    </div>
  );
}

Configuration and Props

You can fully customize the ScrollPilot Component

// Sections list contains Label and Section ID
const sections = [
  {
    label: "Section 1",
    section: "#section1"
  },
  {
    label: "Section 2",
    section: "#section2"
  }
];

const config = {
  index: sections, // Pass your sections list here
  getScrollCompletionVal: (val) => {}, // Returns the value of scrolling progress (ranging between 1 - 100)
  onNavClicked: (val) => {}, // Callback function triggered when the user clicks on a navigation link from the popup
  aesthetics: {
    icon: <>Hi !</>, // Displays an icon at the center of the indicator
    tooltipTxt: "", // Shows text on hover over the indicator
    location: "bottom-right", // Sets the position of the indicator and navigation popup
    size: 50, // Sets the size of the indicator
    hideOnScroll: true, // Hides the indicator while the user is scrolling
    indicatorBackgroundColor: "#ffffff", // Sets the background color of the indicator
    indicatorProgressColor: "#181818", // Sets the progress color of the indicator
    margins: {
      // Applies margins from the sides (e.g., if the location is "bottom-right", it will apply 80px from the bottom and right side)
      desktop: 80,
      mobile: 40 // Customize margins for responsive design
    },
    popupWidths: {
      // Sets the width for the navigation popup
      desktop: "200px",
      mobile: "180px"
    },
    popupBackgroundColor: "#ffffff", // Sets the background color of the navigation popup
    popupLinksColor: "#181818" // Sets the color for navigation links inside the popup
  }
};

// Pass config as a prop to the component
function App() {
  return (
    <div>
      {/* Your content here */}
      <ScrollPilot config={config} />
    </div>
  );
}

You can add this line in the index.css file to enable smooth scrolling

html {
  scroll-behavior: smooth;
}

Configuration Details

| Attribute | Type | Default Value | Description | |---------------------------|-----------------------|---------------|-------------------------------------------------------------------------| | index | Array of objects | [] | Builds an index based on your sections and displays it in a popup when clicked on the indicator. Links will navigate to sections based on given section IDs. | | getScrollCompletionVal() | Function | () | Provides the value (%) of the user's scrolling progress, ranging between 1 - 100. | | onNavClicked() | Function | () | Callback function triggered when the user clicks on a navigation link from the popup. | | icon | HTML Content | <>Hi !</> | Displays provided HTML content (e.g., text, images, SVG, and icons) at the center of the indicator. | | location | String |"bottom-right" | Applies position to indicator, you can specify any value between these 1] top-left 2] top-right 3] bottom-left 4] bottom-right | | tooltipTxt | String | " " | Shows the given tooltip text on hover over the indicator. | | size | Number | 50 | The size of the indicator. The position of nav popup is calculate with size + margin value | | hideOnScroll | Boolean | True | Hides the indicator while the user is scrolling. | | indicatorBackgroundColor | String | #FFFFFF | Changes the background color of the indicator. | | indicatorProgressColor | String | #181818 | Changes the circular progress color of the indicator. | | margins | Object {desktop, mobile} | {desktop: 80, mobile: 40} | Applies margins from the sides based on the given location (e.g., "bottom-right"). Desktop and mobile attributes are provided to maintain margin based on devices. | | popupWidths | Object {desktop, mobile} | {desktop: "200px", mobile: "180px"} | Sets the width of the navigation popup. Desktop and mobile attributes are provided to maintain width based on devices. | | popupBackgroundColor | String | #FFFFFF | Changes the background color of the navigation popup. | | popupLinksColor | String | #181818 | Changes the color of navigation links inside the popup. |

How to run locally ?

If you wish to contribute in repositiory, setup the dev-environment in following way

1] Clone the project

git clone https://github.com/Prasad-Katkade/Scroll-Pilot

2] Install dependancies using NPM

npm install

3] Start Coding !

Note: I plan to integrate Storybook for testing the component in the upcoming future. Until then, you can copy the component into a React project and test it accordingly.

Support

Open for remote work opportunity ! Connect with me here