Skip to content

Commit

Permalink
Merge pull request #444 from bethinkpl/IT-5861_fix_datepicker_open_icon
Browse files Browse the repository at this point in the history
  • Loading branch information
tweetgeek authored Nov 25, 2024
2 parents e553dff + 9523c3f commit bb510e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const args = {
icon: 'FA_CALENDAR_DAY',
isIconHiddenOnMobile: false,
calendarPosition: DATE_PICKER_CALENDAR_POSITIONS.BOTTOM,
errorMessage: '',
errorMessage: null,
state: DATE_PICKER_STATES.DEFAULT,
color: DATE_PICKER_COLORS.NEUTRAL,
disableDates: [new Date(now + oneDayMili * 2).toISOString().slice(0, 10)],
Expand Down
12 changes: 9 additions & 3 deletions lib/js/components/DatePickers/DatePicker/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
@click="toggle"
/>

<span v-if="errorMessage" class="ds-datePicker__errorMessage"> {{ errorMessage }} </span>
<span v-if="showErrorMessage" class="ds-datePicker__errorMessage">
{{ errorMessage }}
</span>
<input ref="flatpickrInputRef" class="ds-datePicker__hiddenInput" />
</div>
</template>
Expand Down Expand Up @@ -113,6 +115,7 @@
@include info-s-default-regular;
color: $color-danger-text;
height: $space-xs;
}
}
</style>
Expand Down Expand Up @@ -185,7 +188,7 @@ export default defineComponent({
},
errorMessage: {
type: String,
default: '',
default: null,
},
state: {
type: String as PropType<DatePickerStates>,
Expand Down Expand Up @@ -275,7 +278,10 @@ export default defineComponent({
if (!this.icon) {
return null;
}
return this.isOpen.value ? ICONS.FA_CHEVRON_UP : this.icon;
return this.isOpen ? ICONS.FA_CHEVRON_UP : this.icon;
},
showErrorMessage() {
return this.errorMessage !== null;
},
},
async mounted() {
Expand Down

0 comments on commit bb510e6

Please sign in to comment.