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-simple-step-wizard

v1.0.0

Published

React simple step wizard

Downloads

388

Readme

Version Build Install Size Downloads PRs Welcome Commitizen friendly MIT License

Watch on GitHub Star on GitHub Tweet

Demo

Click here to see a live demo!

Getting Started

Installation

npm install -S react-simple-step-wizard

Usage

import Wizard from 'react-simple-step-wizard';
import React, { Component } from 'react';

const Step1 = () => <div>This is Step 1</div>;
const Step2 = () => <div>This is Step 2</div>;
const Step3 = () => <div>This is Step 3</div>;
const Step4 = () => <div>This is Step 4</div>;
const Step5 = () => <div>This is Step 5</div>;
const Step6 = () => <div>This is Step 6</div>;
const MyStepTracker = ({ currentStep = 0, steps = [] }) => (
  <div>
    <p>Current step is: {steps[currentStep]}</p>
  </div>
);
const MyNavigator = ({
  getFirstStepProps,
  getLastStepProps,
  getNextStepProps,
  getPrevStepProps,
}) => (
  <div>
    <button type="button" {...getFirstStepProps()}>
      &lt;&lt; First
    </button>
    <button type="button" {...getPrevStepProps()}>
      &lt; Back
    </button>
    <button type="button" {...getNextStepProps()}>
      Next &gt;
    </button>
    <button type="button" {...getLastStepProps()}>
      Last &gt;&gt;
    </button>
  </div>
);

class App extends Component {
  state = { isCustomizeVisible: true };

  handleStepChange = currentStep => {
    console.log(currentStep);
  };

  onClick = () => {
    this.setState(prevState => ({
      isCustomizeVisible: !prevState.isCustomizeVisible,
    }));
  };

  render() {
    const { isCustomizeVisible } = this.state;
    return (
      <div>
        <h1>react-simple-step-wizard demo</h1>
        <div>
          <p>Step 3 visible: {isCustomizeVisible.toString()}</p>
          <button type="button" onClick={this.onClick}>
            Toggle Step 3
          </button>
        </div>
        <Wizard onStepChange={this.handleStepChange}>
          <Wizard.StepTracker />
          <Wizard.Steps>
            <Step1 stepLabel="Search" />
            <Step2 stepLabel="Select" />
            <Step3 stepLabel="Customize" stepCondition={isCustomizeVisible} />
            <Step4 stepLabel="Review" />
            <Wizard.StepGroup stepLabel="Submit">
              <Step5 />
              <Step6 />
            </Wizard.StepGroup>
          </Wizard.Steps>
          {/* You can implement your custom components via render-props */}
          <Wizard.StepTracker>
            {stepTrackerProps => <MyStepTracker {...stepTrackerProps} />}
          </Wizard.StepTracker>
          <Wizard.Navigator>
            {navigatorProps => <MyNavigator {...navigatorProps} />}
          </Wizard.Navigator>
        </Wizard>
      </div>
    );
  }
}

export default App;

Roadmap

V1

Provide an accessible and composable API to be used with older react versions that don't support hooks.

V2

Rewrite lib core and expose some of the APIs using react hooks.

License

MIT © jonathanpalma