import React, { Component } from 'react';
import GetStarted from '../getStarted/getStarted.modal.js';
class BuyAppForm extends Component {
  constructor(props) {
        super(props);
        this.state = {
            name: '',
            email: '',
            industry: '',
            requirement: '',
            isClicked: false,
            isActive: false
        };
        this.handleInputChange = this.handleInputChange.bind(this);
    }
    handleInputChange(event) {
        this.setState({
            [event.target.name]: event.target.value
        });
    }
    toggleModal = () => {
      console.log(this.state.isActive);
      this.setState({
        isActive:!this.state.isActive
      });
      this.setState({
            isClicked:true
        });
    }
    render() {
    
    return (
      <center>
        <div>
          <div className="animated fadeIn">
            <br />
              <div>
                <div className="col-md-6 col-md-offset-3">
                    
                    <div className="mb-1">
                      <input type="text"
                       className="form-control" 
                       placeholder="Name"
                       value={this.state.name}
                        name="name" 
                        onChange={this.handleInputChange}
                       />
                    </div>
                    <div className="mb-1">
                      <input type="text"
                       className="form-control" 
                       placeholder="Email Id"
                       value={this.state.email}
                        name="email" 
                        onChange={this.handleInputChange}
                       />
                    </div>
                    <div className="mb-1">
                      <input type="text"
                       className="form-control" 
                       placeholder="Industry"
                       value={this.state.industry}
                        name="industry" 
                        onChange={this.handleInputChange}
                       />
                    </div>
                    <div className="mb-1">
                      <textarea 
                      className="form-control" 
                      placeholder="Requirement"
                      value={this.state.requirement}
                        name="requirement" 
                        onChange={this.handleInputChange}
                      />
                    </div>
                      <div className="row float-right mx-1" >
                          <button className="btn btn-sm btn-info" onClick={this.toggleModal.bind(this)}>Save</button>
                      </div><br /><br />
                      <div className="row px-1" >
                          <h6>Contact Info</h6>
                      </div>
                      
                  </div>{
                    this.state.isClicked?
                    <GetStarted toggleModal={this.toggleModal} isActive={this.state.isActive}/>:null
                  }
                  
                </div>
            </div>
          </div>
    </center>
    )
    
  }
}
export default BuyAppForm;import React, { Component } from 'react';
import Modal from 'react-modal';
const customStyles = {
  overlay : {
    position          : 'fixed',
    top               : 0,
    left              : 0,
    right             : 0,
    bottom            : 0,
    backgroundColor   : 'rgba(255, 255, 255, 0.75)'
  },
  content : {
    top                   : '20%',
    left                  : '24%',
    right                 : '24%',
    bottom                : 'auto',
    border                     : '1px solid #000',
    background                 : '#fff',
    overflow                   : 'auto',
    WebkitOverflowScrolling    : 'touch',
    outline                    : 'none',
    padding                    : '20px'
  }
};
class StepThree extends Component {
    render() {
    
    return (
      <div style={{ width: 30 + '%' }}>
        <Modal 
          isOpen={this.props.isActive}
          onRequestClose={this.props.toggleModal}
          contentLabel="Modal"
          style={customStyles}
        >
            <div className="card-header">
              <strong><h6>WELCOME TO YOUR DASHBOARD</h6></strong>
            </div><br/>
            
            <div className="text-center">
              <strong>
                <h4>
                  GET STARTED
                </h4>
              </strong>
            </div>
            <div className="text-center">
                
                  You are just 3 steps away from rewarding your customers.<br/><br/>
                    <span className="font-italic font-weight-bold">
                      <h3>
                          <span className="font-color">Step 1 > Step 2  > </span> Step 3
                      </h3>
                        <br/>
                    </span>
            </div>
            <div className="text-center font-weight-bold">
              <strong>
                <h5>
                  Add a Content
                </h5>
              </strong>
            </div><br/>
            <div className="px-2">
              They are essentially tiny, low power computers attached to walls. 
              Using proximity technologies they detect human presence and 
              trigger pre-programmed actions delivering contextual and personalized experiences.
              <strong>Without adding a beacon, Content can not be created.</strong><br/>
               Click NEXT to continue.
            </div><br/>
            
            <div className="panel-body">
              <button className="btn btn-sm btn-info" onClick={this.props.toggleModal}>Prev </button>
              <div className="pull-right">
                <button className="btn btn-sm btn-info" onClick={this.props.toggleModal}>End Tour </button>
              </div>
            </div>
            
        </Modal>
      </div>
    )
    
  }
}
export default StepThree;import React, { Component } from 'react';
import Modal from 'react-modal';
import StepThree from './stepThree.modal.js';
const customStyles = {
  overlay : {
    position          : 'fixed',
    top               : 0,
    left              : 0,
    right             : 0,
    bottom            : 0,
    backgroundColor   : 'rgba(255, 255, 255, 0.75)'
  },
  content : {
    top                   : '20%',
    left                  : '24%',
    right                 : '24%',
    bottom                : 'auto',
    border                     : '1px solid #000',
    background                 : '#fff',
    overflow                   : 'auto',
    WebkitOverflowScrolling    : 'touch',
    outline                    : 'none',
    padding                    : '20px'
  }
};
class StepTwo extends Component {
  constructor(props) {
        super(props);
        this.state = {
            isClicked: false,
            isStepThreeActive: false
        };
    }
  toggleStepThree = () => {
      this.setState({
            isClicked:true
        });
      if (this.props.isActive===true) {
        
        this.props.toggleModal();
      } 
      this.setState({
            isStepThreeActive:!this.state.isStepThreeActive
        });
    }
    render() {
    
    return (
      <div style={{ width: 30 + '%' }}>
        <Modal 
          isOpen={this.props.isActive}
          onRequestClose={this.props.toggleModal}
          contentLabel="Modal"
          style={customStyles}
        >
            <div className="card-header">
              <strong><h6>WELCOME TO YOUR DASHBOARD</h6></strong>
            </div><br/>
            
            <div className="text-center">
              <strong>
                <h4>
                  GET STARTED
                </h4>
              </strong>
            </div>
            <div className="text-center">
                
                  You are just 3 steps away from rewarding your customers.<br/><br/>
                    <span className="font-italic font-weight-bold">
                      <h3>
                          <span className="font-color">Step 1 > </span> Step 2 <span className="font-color"> > Step 3</span>
                      </h3>
                        <br/>
                    </span>
            </div>
            <div className="text-center font-weight-bold">
              <strong>
                <h5>
                  Add a Beacon
                </h5>
              </strong>
            </div><br/>
            <div className="px-2">
              They are essentially tiny, low power computers attached to walls. 
              Using proximity technologies they detect human presence and 
              trigger pre-programmed actions delivering contextual and personalized experiences.
              <strong>Without adding a beacon, Content can not be created.</strong><br/>
               Click NEXT to continue.
            </div><br/>
            
            <div className="panel-body">
              <button className="btn btn-sm btn-info" onClick={this.props.toggleModal}>Prev </button>
              <button className="btn-margin btn btn-sm btn-info" onClick={this.toggleStepThree.bind(this)}>Next </button>         
              <div className="pull-right">
                <button className="btn btn-sm btn-info" onClick={this.props.toggleModal}>End Tour </button>
              </div>
            </div>
        </Modal>
        <StepThree toggleModal={this.toggleStepThree} isActive={this.state.isStepThreeActive}/>
      </div>
    )
    
  }
}
export default StepTwo;import React, { Component } from 'react';
import Modal from 'react-modal';
import StepOne from './stepOne.modal.js';
const customStyles = {
  overlay : {
    position          : 'fixed',
    top               : 0,
    left              : 0,
    right             : 0,
    bottom            : 0,
    backgroundColor   : 'rgba(255, 255, 255, 0.75)'
  },
  content : {
    top                   : '20%',
    left                  : '24%',
    right                 : '24%',
    bottom                : 'auto',
    border                     : '1px solid #000',
    background                 : '#fff',
    overflow                   : 'auto',
    WebkitOverflowScrolling    : 'touch',
    outline                    : 'none',
    padding                    : '20px'
  }
};
class GetStarted extends Component {
  constructor(props) {
        super(props);
        this.state = {
            isClicked: false,
            isStepActive: false
        };
    }
  toggleStep = () => {
      this.setState({
            isClicked:true
        });
      if (this.props.isActive===true) {
            this.props.toggleModal();
      } 
      this.setState({
            isStepActive:!this.state.isStepActive
        });
      
    }
    render() {
    return (
      <div style={{ width: 30 + '%' }}>
        <Modal 
          isOpen={this.props.isActive}
          onRequestClose={this.props.toggleModal}
          contentLabel="Modal"
          style={customStyles}
        >
            <div className="card-header">
              <strong><h6>WELCOME TO YOUR DASHBOARD</h6></strong>
            </div><br/>
            
            <div className="text-center">
              <strong>
                <h4>
                  HELLO
                </h4>
              </strong>
            </div>
            <div className="text-center">
                
                  Welcome to Litifer<br/><br/>
                <img className="get-started-image" src="img/avatars/businessman.png" role="presentation"/>
            </div><br/>
            <div className="px-2">
              Thanks for joining us. We will give you a quick tour to get you started. Click NEXT to continue.
            </div><br/>
            
            <div className="panel-body">
              <button className="btn btn-sm btn-info" onClick={this.toggleStep.bind(this)}>Next </button>        
              <div className="pull-right">
                <button className="btn btn-sm btn-info" onClick={this.props.toggleModal}>End Tour </button>
              </div>
            </div>
              
        </Modal>
        <StepOne toggleModal={this.toggleStep} isActive={this.state.isStepActive}/>
      </div>
    )
    
  }
}
export default GetStarted;import React, { Component } from 'react';
import Modal from 'react-modal';
import StepTwo from './stepTwo.modal.js';
const customStyles = {
  overlay : {
    position          : 'fixed',
    top               : 0,
    left              : 0,
    right             : 0,
    bottom            : 0,
    backgroundColor   : 'rgba(255, 255, 255, 0.75)'
  },
  content : {
    top                   : '20%',
    left                  : '24%',
    right                 : '24%',
    bottom                : 'auto',
    border                     : '1px solid #000',
    background                 : '#fff',
    overflow                   : 'auto',
    WebkitOverflowScrolling    : 'touch',
    outline                    : 'none',
    padding                    : '20px'
  }
};
class StepOne extends Component {
  constructor(props) {
        super(props);
        this.state = {
            isClicked: false,
            isStepTwoActive: false
        };
    }
  toggleStepTwo = () => {
      this.setState({
            isClicked:true
        });
      if (this.props.isActive===true) {
            this.props.toggleModal();
      } 
      this.setState({
            isStepTwoActive:!this.state.isStepTwoActive
        });
    }
    render() {
    
    return (
      <div style={{ width: 30 + '%' }}>
        <Modal 
          isOpen={this.props.isActive}
          onRequestClose={this.props.toggleModal}
          onAfterOpen={() => {}}
          contentLabel="Modal"
          style={customStyles}
        >
            <div className="card-header">
              <strong><h6>WELCOME TO YOUR DASHBOARD</h6></strong>
            </div><br/>
            
            <div className="text-center">
              <strong>
                <h4>
                  GET STARTED
                </h4>
              </strong>
            </div>
            <div className="text-center">
                
                  You are just 3 steps away from rewarding your customers.<br/><br/>
                    <span className="font-italic font-weight-bold">
                      <h3>
                          Step 1 <span className="font-color"> > Step 2 > Step 3</span>
                      </h3>
                        <br/>
                    </span>
            </div>
            <div className="text-center font-weight-bold">
              <strong>
                <h5>
                  Add a Store
                </h5>
              </strong>
            </div><br/>
            <div className="px-2">
              Stores are physical places. 
              Stores need to have detection tags that specify activity areas with existing beacon installations.
              <strong>Without adding stores, beacons can not be added and thus furthur services can't be availed.</strong><br/>
               Click NEXT to continue.
            </div><br/>
            
            <div className="panel-body">
              <button className="btn btn-sm btn-info" onClick={this.props.toggleModal}>Prev </button>
              <button className="btn-margin btn btn-sm btn-info" onClick={this.toggleStepTwo.bind(this)}>Next </button>         
              <div className="pull-right">
                <button className="btn btn-sm btn-info" onClick={this.props.toggleModal}>End Tour </button>
              </div>
            </div>
        </Modal>
        <StepTwo toggleModal={this.toggleStepTwo} isActive={this.state.isStepTwoActive}/>
      </div>
    )
    
  }
}
export default StepOne;This is the snippet i provided. What I'm doing is on clicking a button i had opened a model "GetStarted". In this there is a "next" button, stepOne named model is opened whose snippet i had provided. What i want is now on clicking the "end tour " button i want to close all the modals How to do that?
 
    