GithubHelp home page GithubHelp logo

brock-noah / react-whatever-wizard Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 48 KB

declarative, component based, multistep manager

HTML 3.11% CSS 0.98% JavaScript 95.91%
declarative javascript react ui

react-whatever-wizard's People

Contributors

brock-noah avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

react-whatever-wizard's Issues

How to seperate Component props

Both the StepButton and your component button will need props. How should we separate these to avoid prop name conflicts.

  1. Component's props as an object
<StepButton
  role="next"
  componentClass="button"
  componentProps={ {disabled} }
/>
  1. Step Component props as an object
<StepButton
  wwProps={ {role: "next"} }
  componentClass="button"
  disabled
/>
  1. Some string namespace for whatever wizard props
    _role or ww-role

Button onClick

role handles changes which step it is

  1. button role fires, then button onClick
  2. button onClick fires, then role
  3. button onClick receives the role function as an argument, deciding if it should be called
  4. StepButton.onClick.PropTypes.oneOf(['next', 'back', function])
  5. ignore button's prop onClick, only role fires

Create npm package

  1. current repo is create-react-app
  2. move to only react-whatever-wizard code
  3. create npm package

Buttons

Should Step map the children providing more props to StepButton?

Are any of the following useful to a single standalone button?

  • step number (number)
  • total number of steps (number)
  • on first step (bool)
  • on last step (bool)
  • actions.{first, back, next} (func)

React.Children

Look at route for React.Children.map instead of Array.reduce

How to declare the markup

Having a prop of props seems smelly.

Current:

<WW>
  <Step componentClass={YourStepOne} componentProps={{color: 'blue'}}>
    <StepButton />
  </Step>
</WW>
  • lib calls React.createElement

Possible Alt:

<WW>
  <Step>
    <YourStepOne color="blue">
       <StepButton />
    </YourStepOne>
  </Step>
</WW>

How would this work with layout component? Does layoutComponent wrap all the steps? How does each step override the default props for the layout? Another prop of props, or wrap each step in layoutComponent.

Current:

<WW layoutComponent={YourLayout} layoutProps='Enter Contact Info'>
  <Step componentClass={YourStepOne} componentProps={{color: 'blue'}}>
    <StepButton />
  </Step>
</WW>

Possible Alt:

<WW>
  <YourLayout title='Enter Your Contact Info'>
    <Step>
      <YourStepOne color="blue">
         <StepButton />
      </YourStepOne>
    </Step>
    <Step />
  </YourLayout>
</WW>

Does it provide value?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.