shlink-web-client/src/common/DateInput.js

32 lines
891 B
JavaScript
Raw Normal View History

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}
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>
);
}
}