Skip to content

Instantly share code, notes, and snippets.

@iamkevingreen
Last active May 29, 2018 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamkevingreen/32e2322565bf12b749ffc3fa15f5ebfe to your computer and use it in GitHub Desktop.
Save iamkevingreen/32e2322565bf12b749ffc3fa15f5ebfe to your computer and use it in GitHub Desktop.
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