import React          from "react";
import { withRouter } from "react-router";

class SlideRight extends React.Component{

  constructor(props){
    super(props);
  }

  handleClick(){
    switch(this.props.index) {
      case 0: {
        this.props.router.push("/up/0");
        break;
      }
      case 1: {
        this.props.router.push("/res/1");
        break;
      }
    }
    this.props.slide(this.props.index + 1);
  }

  render(){
    var styles = {};
    if (this.props.index == 2){ // last slide
      styles = { visibility: 'hidden' };
    }
    else{
      styles = { visibility: 'visible' };
    }
    return <a className="slide-right" style={styles} onClick={this.handleClick.bind(this)}  href="#"><i className="fa fa-angle-right" id="ninja-slider-next" aria-hidden="true"></i></a>;
  }
};

SlideRight.propTypes = {
  router: React.PropTypes.shape({
    push: React.PropTypes.func.isRequired
  }).isRequired
}

var decorated = withRouter(SlideRight);

module.exports = decorated;
