2018-07-31 22:24:34 +03:00
|
|
|
import calendarIcon from '@fortawesome/fontawesome-free-regular/faCalendarAlt';
|
|
|
|
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
|
|
|
|
import React from 'react';
|
|
|
|
import DatePicker from 'react-datepicker';
|
2018-08-05 09:28:16 +03:00
|
|
|
import './DateInput.scss';
|
2018-07-31 22:24:34 +03:00
|
|
|
|
|
|
|
export default class DateInput extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.inputRef = React.createRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className="date-input-container">
|
|
|
|
<DatePicker
|
|
|
|
{...this.props}
|
2018-07-31 23:04:20 +03:00
|
|
|
className={`date-input-container__input form-control ${this.props.className || ''}`}
|
2018-07-31 22:24:34 +03:00
|
|
|
dateFormat="YYYY-MM-DD"
|
|
|
|
readOnly
|
|
|
|
ref={this.inputRef}
|
|
|
|
/>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={calendarIcon}
|
|
|
|
className="date-input-container__icon"
|
|
|
|
onClick={() => this.inputRef.current.input.focus()}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|