diff --git a/src/common/DateInput.js b/src/common/DateInput.js
index 7df47732..b246405c 100644
--- a/src/common/DateInput.js
+++ b/src/common/DateInput.js
@@ -3,6 +3,7 @@ import FontAwesomeIcon from '@fortawesome/react-fontawesome';
import React from 'react';
import DatePicker from 'react-datepicker';
import './DateInput.scss';
+import { isNil } from 'ramda';
export default class DateInput extends React.Component {
constructor(props) {
@@ -11,6 +12,9 @@ export default class DateInput extends React.Component {
}
render() {
+ const { isClearable, selected } = this.props;
+ const showCalendarIcon = !isClearable || isNil(selected);
+
return (
- this.inputRef.current.input.focus()}
- />
+ />}
);
}
diff --git a/src/common/DateInput.scss b/src/common/DateInput.scss
index f9f41b71..ba4563d5 100644
--- a/src/common/DateInput.scss
+++ b/src/common/DateInput.scss
@@ -1,4 +1,5 @@
@import '../utils/mixins/vertical-align';
+@import '../utils/base';
.date-input-container {
position: relative;
@@ -11,6 +12,18 @@
.date-input-container__icon {
@include vertical-align();
- right: 15px;
+ right: .75rem;
cursor: pointer;
}
+
+.react-datepicker__close-icon.react-datepicker__close-icon {
+ @include vertical-align();
+ right: 0;
+}
+
+.react-datepicker__close-icon.react-datepicker__close-icon::after {
+ right: .75rem;
+ line-height: 11px;
+ background-color: #333;
+ font-size: 14px;
+}
diff --git a/src/short-urls/CreateShortUrl.js b/src/short-urls/CreateShortUrl.js
index 94f61c27..3f7782e4 100644
--- a/src/short-urls/CreateShortUrl.js
+++ b/src/short-urls/CreateShortUrl.js
@@ -48,6 +48,7 @@ export class CreateShortUrl extends React.Component {
selected={this.state[id]}
placeholderText={placeholder}
onChange={date => this.setState({ [id]: date })}
+ isClearable
{...props}
/>;
const formatDate = date => isNil(date) ? date : date.format();
diff --git a/src/short-urls/ShortUrlVisits.js b/src/short-urls/ShortUrlVisits.js
index 98581361..543714ce 100644
--- a/src/short-urls/ShortUrlVisits.js
+++ b/src/short-urls/ShortUrlVisits.js
@@ -150,6 +150,7 @@ export class ShortUrlsVisits extends React.Component {
this.setState({ startDate: date }, () => this.loadVisits())}
/>
@@ -157,6 +158,7 @@ export class ShortUrlsVisits extends React.Component {
this.setState({ endDate: date }, () => this.loadVisits())}
className="short-url-visits__date-input"
/>