11// import moment from 'moment'
22import React , { PropTypes , Component } from 'react'
3- import { Form , FormGroup , FormControl } from 'react-bootstrap'
3+ import { Form , FormGroup , FormControl , Row , Col } from 'react-bootstrap'
44// import { SingleDatePicker } from 'react-dates'
55import { connect } from 'react-redux'
66
77import { setDepart , setDate , setTime } from '../../actions/form'
88
99class DateTimeSelector extends Component {
1010 static propTypes = {
11+ date : PropTypes . string ,
12+ departArrive : PropTypes . string ,
13+ time : PropTypes . string ,
1114 location : PropTypes . object ,
1215 label : PropTypes . string ,
16+ setDate : PropTypes . func ,
17+ setDepart : PropTypes . func ,
1318 setLocation : PropTypes . func ,
19+ setTime : PropTypes . func ,
1420 type : PropTypes . string // replace with locationType?
1521 }
1622 constructor ( props ) {
@@ -36,32 +42,43 @@ class DateTimeSelector extends Component {
3642 const options = [ 'NOW' , 'DEPART' , 'ARRIVE' ]
3743 // TODO: choose date / time selectors (currently Chrome optimized)
3844 return (
39- < Form inline >
40- < FormGroup style = { { marginBottom : '15px' } } >
41- < FormControl
42- componentClass = 'select'
43- value = { departArrive }
44- onChange = { this . _onDepartChange }
45- style = { { width : '100px' } }
46- >
47- { options . map ( ( o , i ) => (
48- < option key = { i } value = { o } > { o } </ option >
49- ) ) }
50- </ FormControl >
51- { ' ' }
52- < FormControl
53- type = 'date'
54- value = { date }
55- onChange = { this . _onDateChange }
56- style = { { width : '160px' , display : departArrive === 'NOW' && 'none' } }
57- />
58- { ' ' }
59- < FormControl
60- type = 'time'
61- value = { time }
62- onChange = { this . _onTimeChange }
63- style = { { width : '123px' , display : departArrive === 'NOW' && 'none' } }
64- />
45+ < Form >
46+ < FormGroup style = { { marginBottom : '15px' } } className = 'date-time-selector' >
47+ < Row >
48+ < Col xs = { 6 } >
49+ < FormControl
50+ componentClass = 'select'
51+ value = { departArrive }
52+ onChange = { this . _onDepartChange }
53+ style = { { width : '100%' } }
54+ >
55+ { options . map ( ( o , i ) => (
56+ < option key = { i } value = { o } > { o } </ option >
57+ ) ) }
58+ </ FormControl >
59+ </ Col >
60+ < Col > { } </ Col >
61+ </ Row >
62+ < Row style = { { marginTop : 10 } } >
63+ < Col xs = { 6 } >
64+ < FormControl
65+ className = 'date-selector'
66+ type = 'date'
67+ value = { date }
68+ onChange = { this . _onDateChange }
69+ style = { { width : '100%' , display : departArrive === 'NOW' && 'none' } }
70+ />
71+ </ Col >
72+ < Col xs = { 6 } >
73+ < FormControl
74+ className = 'time-selector'
75+ type = 'time'
76+ value = { time }
77+ onChange = { this . _onTimeChange }
78+ style = { { width : '100%' , display : departArrive === 'NOW' && 'none' } }
79+ />
80+ </ Col >
81+ </ Row >
6582 </ FormGroup >
6683 </ Form >
6784 )
0 commit comments