| Total Complexity | 0 |
| Complexity/F | 0 |
| Lines of Code | 41 |
| Function Count | 0 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | import React from 'react'; |
||
| 2 | import PropTypes from 'prop-types'; |
||
| 3 | import DateInput from './DateInput'; |
||
| 4 | import './DateRangeRow.scss'; |
||
| 5 | |||
| 6 | 3 | const dateType = PropTypes.oneOfType([ PropTypes.string, PropTypes.object ]); |
|
| 7 | 3 | const propTypes = { |
|
| 8 | startDate: dateType, |
||
| 9 | endDate: dateType, |
||
| 10 | onStartDateChange: PropTypes.func.isRequired, |
||
| 11 | onEndDateChange: PropTypes.func.isRequired, |
||
| 12 | }; |
||
| 13 | |||
| 14 | 3 | const DateRangeRow = ({ startDate, endDate, onStartDateChange, onEndDateChange }) => ( |
|
| 15 | 3 | <div className="row"> |
|
| 16 | <div className="col-xl-3 col-lg-4 col-md-6 offset-xl-6 offset-lg-4"> |
||
| 17 | <DateInput |
||
| 18 | selected={startDate} |
||
| 19 | placeholderText="Since" |
||
| 20 | isClearable |
||
| 21 | maxDate={endDate} |
||
| 22 | onChange={onStartDateChange} |
||
| 23 | /> |
||
| 24 | </div> |
||
| 25 | <div className="col-xl-3 col-lg-4 col-md-6"> |
||
| 26 | <DateInput |
||
| 27 | className="date-range-row__date-input" |
||
| 28 | selected={endDate} |
||
| 29 | placeholderText="Until" |
||
| 30 | isClearable |
||
| 31 | minDate={startDate} |
||
| 32 | onChange={onEndDateChange} |
||
| 33 | /> |
||
| 34 | </div> |
||
| 35 | </div> |
||
| 36 | ); |
||
| 37 | |||
| 38 | 3 | DateRangeRow.propTypes = propTypes; |
|
| 39 | |||
| 40 | export default DateRangeRow; |
||
| 41 |