Passed
Pull Request — master (#187)
by Alejandro
09:37
created

src/utils/DateRangeRow.js

Complexity

Total Complexity 0
Complexity/F 0

Size

Lines of Code 41
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 0
eloc 36
mnd 0
bc 0
fnc 0
dl 0
loc 41
ccs 5
cts 5
cp 1
bpm 0
cpm 0
noi 0
c 0
b 0
f 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