import React from 'react'
import {AD_TYPE_SALE, AD_TYPE_RENT} from '../../../common/enums';

export default class Welcome extends React.Component {

  constructor (props) {
    super(props)

    this.state = {
      type: AD_TYPE_SALE,
    }
  }

  onSaleClick () {
    this.setState({
      type: AD_TYPE_SALE,
    })
  }

  onRentClick () {
    this.setState({
      type: AD_TYPE_RENT,
    })
  }

  render () {
    return (
      <div>
      <div className='welcome-container-bg'>
      </div>
      <div className='welcome-container'>

        <div className='welcome-content'>
        <h1>KIVI</h1>
        <h2>Pronađi svoj novi dom!</h2>
        <div>
          <button className={this.state.type===AD_TYPE_SALE?'buy-button-active':'buy-button-inactive'}  onClick={this.onSaleClick.bind(this)}></button>
          <button className={this.state.type===AD_TYPE_RENT?'rent-button-active':'rent-button-inactive'}  onClick={this.onRentClick.bind(this)}></button>
        </div>
        <button className='search-button' onClick={()=>this.props.onSearch({adType: this.state.type})} >TRAŽI</button>
        </div>

      </div>
    </div>
    )
  }
}
