feat(components/onboarding_modal): Swipe between pages (#3934)
parent
741fd15f4e
commit
8180d8bc35
|
@ -3,6 +3,7 @@ import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||||
|
import ReactSwipeable from 'react-swipeable';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import Permalink from '../../../components/permalink';
|
import Permalink from '../../../components/permalink';
|
||||||
import TransitionMotion from 'react-motion/lib/TransitionMotion';
|
import TransitionMotion from 'react-motion/lib/TransitionMotion';
|
||||||
|
@ -274,7 +275,7 @@ export default class OnboardingModal extends React.PureComponent {
|
||||||
<div className='modal-root__modal onboarding-modal'>
|
<div className='modal-root__modal onboarding-modal'>
|
||||||
<TransitionMotion styles={styles}>
|
<TransitionMotion styles={styles}>
|
||||||
{interpolatedStyles => (
|
{interpolatedStyles => (
|
||||||
<div className='onboarding-modal__pager'>
|
<ReactSwipeable onSwipedRight={this.handlePrev} onSwipedLeft={this.handleNext} className='onboarding-modal__pager'>
|
||||||
{interpolatedStyles.map(({ key, data, style }, i) => {
|
{interpolatedStyles.map(({ key, data, style }, i) => {
|
||||||
const className = classNames('onboarding-modal__page__wrapper', {
|
const className = classNames('onboarding-modal__page__wrapper', {
|
||||||
'onboarding-modal__page__wrapper--active': i === currentIndex,
|
'onboarding-modal__page__wrapper--active': i === currentIndex,
|
||||||
|
@ -283,7 +284,7 @@ export default class OnboardingModal extends React.PureComponent {
|
||||||
<div key={key} style={style} className={className}>{data}</div>
|
<div key={key} style={style} className={className}>{data}</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</ReactSwipeable>
|
||||||
)}
|
)}
|
||||||
</TransitionMotion>
|
</TransitionMotion>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue