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-slade

v1.5.0

Published

React dialog component that slide-able

Downloads

132

Readme

react-slade

style: styled-components

Table of Contents

Examples

react-slade examples page

you can try live example above here

Installation

To install, you can use npm and yarn :

$ npm install react-slade
or
$ yarn add react-slade

API Documentation

name | type | description | is required --- | --- | --- | --- open | boolean | defines the state when the Slade is open or not | true items | array | array of Component that will be slide-able | true index | int | defines which Component is showed when the open become true | true closeSlade | function | close active Slade with change the open to false | true nextSlade | function | increment current index of Slade | true previousSlade | function | decrement current index of Slade | true backdrop | string | predefined color like red, rgb/rgba and hsl/hsla like rgba(0,0,0,0.5), or image url like https://example.com/bg.png/ | false rightArrow | string or svg | svg component (100 x 60) or image url like https://example.com/arr.png/. If you change right arrow, all arrow will automatically changed and got rotated | false

Usage

This is example of basic usage

import React, { Component } from 'react'
import Slade from 'react-slade'

import Container from '../components/Container'
import Button from '../components/Button';
import Image from '../components/Dummy/Image'

class Home extends Component {
  state = {
    open: false,
    index: 0,
    items: [ 
      <Image src= "url1" />,
      <Image src= "url2" />,
      <Image src= "url3" />
    ]
  }

  openSlade = () => {
    this.setState({ open: true })
  }

  closeSlade = () => {
    this.setState({ open: false })
  }

  nextSlade = () => {
    this.setState({ index: this.state.index + 1 })
  }

  previousSlade = () => {
    this.setState({ index: this.state.index - 1 })
  }

  render() {
    return (
      <Container>
        <Slade 
          items={this.state.items} 
          open={this.state.open} 
          index={this.state.index} 
          closeSlade={this.closeSlade}
          nextSlade={this.nextSlade}
          previousSlade={this.previousSlade} 
        />
        <Button onClick={this.openSlade}>Show Dialog</Button>
      </Container>
    )
  }
}

FAQ

Q: I got an error when import from local file, for example arrow={'./myArrow.svg'}

A: Ups, sorry this library not supported that feature yet. Feel free to do pull request

Q: Are we still need media queries for component that we passed?

A: For best result you must define it by yourself though (i believe in flexibelity)

Q: I think props like nextSlade and previousSlade is redundant, why not try to remove that item?

A: Again, I believe in flexibelity. You can put your extra feature there. For example you can add confetti when user reach end of slade, or you can disable user to change Slade before doing something, etc