# All files / components/DatePicker DatePicker.js

0% Statements 0/37
0% Branches 0/12
0% Functions 0/4
0% Lines 0/11

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44

     import React from 'react';
    import PropTypes from 'prop-types';
    import 'react-dates/initialize';
    import {
      SingleDatePicker as LibDatePicker,
      SingleDatePickerShape,
    } from 'react-dates';
    import Icon from '../Icon';
    import DatePickerWrapper from './styles/DatePickerWrapper';

    import DateRangePicker from './DateRangePicker';

    const DatePicker = ({ Wrapper, ...props }) => (
      <Wrapper>
        <LibDatePicker
          {...props}
          navPrev={<Icon name="back" size="12px" />}
          navNext={<Icon name="forward" size="12px" />}
          weekDayFormat="dd"
          displayFormat="MMM DD YYYY"
          daySize={37}
          horizontalMargin={0}
          numberOfMonths={1}
        />
      </Wrapper>
    );

    DatePicker.propTypes = {
      ...SingleDatePickerShape,
      id: PropTypes.string,
      /**
       * A component to wrap and control styles of the underlying react-dates DatePicker
       */
      Wrapper: PropTypes.func,
    };

    DatePicker.defaultProps = {
      Wrapper: DatePickerWrapper,
    };

    DatePicker.Range = DateRangePicker;

    export default DatePicker;