Skip to content

Commit a0015cd

Browse files
committed
feat: improve label handling for linear scale component with dynamic display
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent 93dd29b commit a0015cd

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

src/components/Questions/QuestionLinearScale.vue

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,21 @@
3434
<IconPencil :size="20" />
3535
</template>
3636
</NcActionInput>
37-
<NcActionInput>
37+
<NcActionInput
38+
v-model="labelLowest"
39+
:label="t('forms', 'Label for lowest value')"
40+
label-outside
41+
:show-trailing-button="false">
3842
<template #icon>
3943
<IconPencil :size="20" />
4044
</template>
4145
{{ t('forms', 'Label for lowest value') }}
4246
</NcActionInput>
43-
<NcActionInput>
47+
<NcActionInput
48+
v-model="labelHighest"
49+
:label="t('forms', 'Label for highest value')"
50+
label-outside
51+
:show-trailing-button="false">
4452
<template #icon>
4553
<IconPencil :size="20" />
4654
</template>
@@ -49,6 +57,7 @@
4957
</template>
5058

5159
<div class="question__content">
60+
<template v-if="labelLowest !== ''">{{ labelLowest }}</template>
5261
<NcCheckboxRadioSwitch
5362
v-for="option in scaleOptions"
5463
:key="option"
@@ -65,6 +74,7 @@
6574
@keydown.enter.exact.prevent="onKeydownEnter">
6675
{{ option }}
6776
</NcCheckboxRadioSwitch>
77+
<template v-if="labelHighest !== ''">{{ labelHighest }}</template>
6878
</div>
6979
</Question>
7080
</template>
@@ -95,6 +105,8 @@ export default {
95105
96106
lowestOption: 1,
97107
highestOption: 5,
108+
labelLowest: 'Lowest',
109+
labelHighest: 'Highest',
98110
}
99111
},
100112
@@ -147,4 +159,13 @@ export default {
147159
}
148160
</script>
149161
150-
<style lang="scss" scoped></style>
162+
<style lang="scss" scoped>
163+
.question__content {
164+
all: unset;
165+
display: flex;
166+
flex-direction: row;
167+
justify-content: center;
168+
width: 100%;
169+
align-items: center;
170+
}
171+
</style>

0 commit comments

Comments
 (0)