import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft'; import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight'; import SwipeableViews from 'react-swipeable-views'; import imgApi from 'ba-api/images'; import { MobileStepper, Paper, Typography, Button, Grid } from '@material-ui/core'; const tutorialSteps = [ { label: 'How to be happy :)', imgPath: imgApi[45], }, { label: '1. Work with something that you like, like…', imgPath: imgApi[33], }, { label: '2. Keep your friends close to you and hangout with them', imgPath: imgApi[14], }, { label: '3. Travel everytime that you have a chance', imgPath: imgApi[9], }, { label: '4. And contribute to Material-UI :D', imgPath: imgApi[44], }, ]; const styles = theme => ({ root: { [theme.breakpoints.up('sm')]: { width: 400, }, flexGrow: 1, }, header: { textAlign: 'center', height: 50, paddingLeft: theme.spacing(4), marginBottom: 20, backgroundColor: theme.palette.background.default, }, img: { height: 255, maxWidth: 400, overflow: 'hidden', width: '100%', margin: '0 auto' }, figure: { maxWidth: 400, overflow: 'hidden', margin: '0 auto' }, mobileStepper: { [theme.breakpoints.up('sm')]: { width: 400, }, margin: '0 auto', textAlign: 'center' } }); class StepperCarousel extends React.Component { state = { activeStep: 0, activeStepSwipe: 0, }; handleNext = () => { this.setState(prevState => ({ activeStep: prevState.activeStep + 1, })); }; handleBack = () => { this.setState(prevState => ({ activeStep: prevState.activeStep - 1, })); }; handleNextSwipe = () => { this.setState(prevState => ({ activeStepSwipe: prevState.activeStepSwipe + 1, })); }; handleBackSwipe = () => { this.setState(prevState => ({ activeStepSwipe: prevState.activeStepSwipe - 1, })); }; handleStepChangeSwipe = activeStepSwipe => { this.setState({ activeStepSwipe }); }; render() { const { classes, theme } = this.props; const { activeStep, activeStepSwipe } = this.state; const maxSteps = tutorialSteps.length; const maxStepsSwipe = tutorialSteps.length; return ( {tutorialSteps[activeStep].label} {tutorialSteps[activeStep].label} Next {theme.direction === 'rtl' ? : } )} backButton={( )} /> {tutorialSteps[activeStepSwipe].label} {tutorialSteps.map((step, index) => (
{step.label}
))}
Next {theme.direction === 'rtl' ? : } )} backButton={( )} />
); } } StepperCarousel.propTypes = { classes: PropTypes.object.isRequired, theme: PropTypes.object.isRequired, }; export default withStyles(styles, { withTheme: true })(StepperCarousel);