Skip to content

Commit

Permalink
fix(datepicker): fix cv wrapper & label
Browse files Browse the repository at this point in the history
  • Loading branch information
weslleyrsr committed Apr 3, 2023
1 parent 5f0a26a commit b9ce4fc
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/components/CvDatePicker/CvDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
}"
@change="onChange"
>
<label :for="`${cvId}-input-1`" :class="`${carbonPrefix}--label`">
<label
v-if="getDateLabel.length > 0"
:for="`${cvId}-input-1`"
:class="`${carbonPrefix}--label`"
>
{{ getDateLabel }}
</label>
<div :class="`${carbonPrefix}--date-picker-input__wrapper`">
Expand Down Expand Up @@ -59,9 +63,11 @@ import {
import { carbonPrefix } from '../../global/settings';
import { props as propsCvId, useCvId } from '../../use/cvId';
import { Calendar16 } from '@carbon/icons-vue';
import CvWrapper from '../CvWrapper/CvWrapper';
const props = defineProps({
label: { type: String, default: 'Date' },
dateLabel: { type: String, default: undefined },
dateEndLabel: { type: String, default: 'End date' },
pattern: { type: String, default: '\\d{1,2}/\\d{1,2}/\\d{4}' },
placeholder: { type: String, default: 'mm/dd/yyyy' },
formItem: { type: Boolean, default: true },
Expand All @@ -74,6 +80,14 @@ const props = defineProps({
const getDateLabel = computed({
get() {
if (props.kind === 'range' && !props.dateLabel) {
return 'Start date';
}
if (!props.dateLabel) {
return 'Date Label';
}
return props.label;
},
});
Expand Down

0 comments on commit b9ce4fc

Please sign in to comment.