import React, { Component } from 'react';

export default class BrowserAdressBar extends Component {
	constructor (props) {
		super(props)

		this.handleGo = this.handleGo.bind(this)
	}

	handleGo (e) {
		e.preventDefault()
		console.log('submitting stdin handler', this.refs.browswerAdressBar.value);
		this.props.browserAdressBarHandler(this.refs.browswerAdressBar.value)
	}
	render() {
		return (
			<div className='IoTyBrowswer'>
				<form className='form-group' onSubmit={this.handleGo}>
	              <input 
	              	type='text' 
	              	className='form-control' 
	              	ref='browswerAdressBar' 
	              	name='BrowserAdressBar__url' 
	              	id='BrowserAdressBar__URL' 
	              	className='browswerAdressBar'
	              	placeholder='Enter URL'
	              	autoComplete="off"/>
	              	<button
			          className="btn btn-default"
			          id='stdin-submit-button'
			          onClick={this.handleGo}>
			         	<i className="fa fa-arrow-right" aria-hidden="true"></i>
			        </button>
	          		<div className='BrowserContentView' id='BrowserContentView__messages'>
					</div>
	            </form>
            </div>
		);
	}
}
