import React, { Component } from 'react'
import {InputNumber, Row, Col } from 'antd'

class Number extends Component {
	render() {
		let {
			value,
			scope
		} = this.props
        if(value===""&&scope ==="among"){
            value={}
        }
		if(scope ==="among") {
			return (
				<Row className="u-field-search-among">
					<Col  span={11}>
						<InputNumber  className="rep-u-field-search-number" value={value.start} onChange={(val)=>{
							let newValue = value;
							newValue.start = val;
							this.props.onChange(newValue)
						}} />
					</Col>
					<Col span={1}  offset={1}>
						-
					</Col>
					<Col  span={11} >
						<InputNumber  className="rep-u-field-search-number" value={value.end} onChange={(val)=>{
							let newValue1 = value;
							newValue1.end = val;
							this.props.onChange(newValue1)
						}} />
					</Col>
				</Row>
			)
		}else{
			return (
				<InputNumber className="rep-u-field-search-number"  value={value} onChange={value=>this.props.onChange(value)} />
			)	
		}


	}
}

export default Number
