import React, { Component } from "react"; import { withStyles, Typography, MobileStepper, Button } from "@material-ui/core"; import { styles } from "./Attachment.styles"; import { Attachment } from "../../types/Attachment"; import SwipeableViews from "react-swipeable-views"; interface IAttachmentProps { media: [Attachment]; classes?: any; } interface IAttachmentState { totalSteps: number; currentStep: number; attachments: [Attachment]; } class AttachmentComponent extends Component< IAttachmentProps, IAttachmentState > { constructor(props: IAttachmentProps) { super(props); this.state = { attachments: this.props.media, totalSteps: this.props.media.length, currentStep: 0 }; } moveBack() { let nextStep = this.state.currentStep - 1; if (nextStep < 0) { nextStep = 0; } this.setState({ currentStep: nextStep }); } moveForward() { let nextStep = this.state.currentStep + 1; if (nextStep > this.state.totalSteps) { nextStep = this.state.totalSteps; } this.setState({ currentStep: nextStep }); } handleStepChange(currentStep: number) { this.setState({ currentStep }); } getSlide(slide: Attachment) { const { classes } = this.props; switch (slide.type) { case "image": return ( {slide.description ); case "video": return (