mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
datepicker: add clear button (#12480)
* datepicker: add clear button * use close icon instead of "x" as text
This commit is contained in:
@@ -276,6 +276,7 @@
|
|||||||
:date.sync="task.date"
|
:date.sync="task.date"
|
||||||
:disabled="challengeAccessRequired"
|
:disabled="challengeAccessRequired"
|
||||||
:highlighted="calendarHighlights"
|
:highlighted="calendarHighlights"
|
||||||
|
:clear-button="true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,6 +12,12 @@
|
|||||||
calendar-class="calendar-padding"
|
calendar-class="calendar-padding"
|
||||||
@input="upDate($event)"
|
@input="upDate($event)"
|
||||||
>
|
>
|
||||||
|
<div slot="afterDateInput"
|
||||||
|
class="vdp-datepicker__clear-button"
|
||||||
|
v-if="clearButton && value"
|
||||||
|
v-html="icons.close"
|
||||||
|
@click="upDate(null)">
|
||||||
|
</div>
|
||||||
<div slot="beforeCalendarHeader">
|
<div slot="beforeCalendarHeader">
|
||||||
<div class="datetime-buttons">
|
<div class="datetime-buttons">
|
||||||
<button
|
<button
|
||||||
@@ -37,17 +43,19 @@
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import datepicker from 'vuejs-datepicker';
|
import datepicker from 'vuejs-datepicker';
|
||||||
import calendarIcon from '@/assets/svg/calendar.svg';
|
import calendarIcon from '@/assets/svg/calendar.svg';
|
||||||
|
import closeIcon from '@/assets/svg/close.svg';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
datepicker,
|
datepicker,
|
||||||
},
|
},
|
||||||
props: ['date', 'disabled', 'highlighted'],
|
props: ['date', 'disabled', 'highlighted', 'clearButton'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
value: this.date,
|
value: this.date,
|
||||||
icons: Object.freeze({
|
icons: Object.freeze({
|
||||||
calendar: calendarIcon,
|
calendar: calendarIcon,
|
||||||
|
close: closeIcon,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -195,4 +203,17 @@ export default {
|
|||||||
color: $gray-50;
|
color: $gray-50;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vdp-datepicker__clear-button {
|
||||||
|
background: transparent !important;
|
||||||
|
display: block;
|
||||||
|
height: 30px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
margin: auto 0.75rem;
|
||||||
|
width: 0.75rem;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user