Last active
May 29, 2018 19:25
-
-
Save iamkevingreen/32e2322565bf12b749ffc3fa15f5ebfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { Strider, Step } from 'react-strider'; | |
import cx from 'classnames' | |
class App extends React.Component { | |
render () { | |
return ( | |
<div> | |
<h1>React Strider</h1> | |
<Strider activeIndex={0} transitionSpeed={400}> | |
<Step> | |
{({ next, goTo, active, hiding, activeIndex }) => ( | |
<div className={cx('step__wrapper', { | |
'is-active': active, | |
'is-hiding': hiding | |
})}> | |
<StepOne next={next} /> | |
</div> | |
)} | |
</Step> | |
<Step> | |
{({ prev, goTo, active, hiding, activeIndex }) => ( | |
<div className={cx('step__wrapper', { | |
'is-active': active, | |
'is-hiding': hiding | |
})}> | |
<StepTwo prev={prev} /> | |
</div> | |
)} | |
</Step> | |
</Strider> | |
</div> | |
) | |
} | |
} | |
class StepOne extends React.Component { | |
render () { | |
return ( | |
<div> | |
<h4>Step 1</h4> | |
<span onClick={() => this.props.next()}>Next</span> | |
</div> | |
) | |
} | |
} | |
class StepTwo extends React.Component { | |
render () { | |
return ( | |
<div> | |
<h4>Step 2</h4> | |
<span onClick={() => this.props.prev()}>Previous</span> | |
</div> | |
) | |
} | |
} | |
ReactDOM.render(<App />, | |
document.getElementById("root") | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment