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

react-rellax-wrapper

v1.0.6

Published

A react wrapper around the Rellax javascript library. Rellax -> https://dixonandmoe.com/rellax/

Downloads

307

Readme

React Rellax Wrapper 🎁

NPM version NPM downloads Storybook

About

react-rellax-wrapper provides a react wrapper around the Rellax js library. This allows for a more idomatic React way of handling parallax with the Rellax library.

Rellax Library https://dixonandmoe.com/rellax/

Examples

Check out the Storybook

Or run your own

$ git clone https://github.com/scottjr632/react-rellax-wrapper.git && cd react-rellax-wrapper
$ npm install
$ npm run storybook

Installing

npm

$ npm install react-rellax-wrapper

yarn

$ yarn add react-rellax-wrapper

Getting started

Import RellaxWrapper and wrap the component that you want to add the parralex feature to with RellaxWrapper.

import RellaxWrapper from 'react-rellax-wrapper'
// or
import { RellaxWrapper } from 'react-rellax-wrapper'

const App = () => (
  <div>
    <RellaxWrapper speed={7}>
      <h1>I am really fast!</h1>
    </RellaxWrapper>
    <RellaxWrapper speed={-9} percentage={0.9}>
      <div>
        <p>I am really slow</p>
      </div>
    </RellaxWrapper>
  </div>
)

Props

All props are optional

If a prop is ommited it will default to the rellax's generic default. For example if speed is omited default speed is -2.
All traditional options for Rellax can also be used such as callback, center, and relativeToWrapper.

interface RellaxWrapperProps {
  style?: React.CSSProperties;
  className?: string;
  zIndex?: number;

  /**
   * Centered parallax elements in your viewport. 0.5 is centered.
   */
  percentage?: number;

  /**
   * Specify different speeds for xs devices
   */
  xs?: number;

  /**
   * Specify different speeds for mobile devices. Default breakpoint is 576.
   */
  mobile?: number;

  /**
   * Specify different speeds for tablets. Default breakpoint is 768.
   */
  tablet?: number;

  /**
   * Specify different speeds for desktop devices. Default breakpoint is 1201.
   */
  desktop?: number;

  /**
   * Will run on every animation event
   * @param positions Object with x and y positions of the rellax element
   */
  callback?(positions: { x: number; y: number }): void;

  /**
   * Enable the ability to center parallax elements in your viewport
   */
  center?: boolean;

  /**
   * Enable horizontal parallax. This feature is intended for panoramic style websites, where users scroll horizontally instead of vertically
   */
  horizontal?: boolean;

  /**
   * Allow decimal pixel values
   */
  round?: boolean;

  /**
   * A negative value will make it move slower than regular scrolling, and a positive value will make it move faster
   */
  speed?: number;

  /**
   * Enable vertical parallax
   */
  vertical?: boolean;

  /**
   * By default, the position of parallax elements is determined via the scroll position of the body. Passing in the wrapper property will tell Rellax to watch that element instead
   */
  wrapper?: string | HTMLElement;

  /**
   * Do we want rellax element to be relative to the mentioned wrapper.
   */
  relativeToWrapper?: boolean;

  /**
   * Each breakpoint value represents the resolution for mobile, tablet, desktop respectively.
   */
  breakpoints?: [number, number, number];
}