import React, { Component } from 'react';
import  {Snackbar} from 'material-ui';
export default class SnackbarMessage extends Component {
	constructor(props) {
	    super(props);
	    this.state = {
	      open: this.props.open,
	      duration : 2500
	    };
	  }

	  handleTouchTap = () => {
	    this.setState({
	      open: true,
	    });
	  };

	  handleRequestClose = () => {
	    this.setState({
	      open: false,
	    });
	  };

	  handleActionClick = () =>{
	  	this.setState({
	  		duration : 0
	  	})
	  }

	  render() {
	    return (
	      <div>
	        <Snackbar
	          open={this.props.open}
	          action="OK"
	          message={this.props.message}
            onActionClick={this.props.closeSnackbar}
	          autoHideDuration={this.state.duration}
	        />
	      </div>
	    );
	  }
}

