Add custom textarea component

This commit is contained in:
Ramon Wenger 2022-12-22 21:26:00 +01:00
parent 4702c92744
commit 36847175c7
3 changed files with 52 additions and 29 deletions

View File

@ -50,34 +50,32 @@ eLearning)?"
genommen u. aufgegriffen." genommen u. aufgegriffen."
:items="RATINGS" :items="RATINGS"
/> />
<div class="mb-8"> <ItTextarea
<p class="mb-4">Was ich dem Kursleiter sonst noch sagen wollte:</p> v-if="stepNo === 7"
<textarea v-model="instructorOpenFeedback"
v-model="instructorOpenFeedback" :label="instructorOpenFeedbackLabel"
rows="4" class="mb-8"
class="block w-full rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" />
/> <ItTextarea
</div> v-if="stepNo === 8"
<div class="mb-8"> v-model="courseNegativeFeedback"
<p class="mb-4">Wo sehen Sie Verbesserungspotenzial?</p> :label="courseNegativeFeedbackLabel"
<textarea class="mb-8"
v-model="courseNegativeFeedback" />
rows="4" <ItTextarea
class="block w-full rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" v-if="stepNo === 9"
/> v-model="coursePositiveFeedback"
<!-- class="block w-full rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"--> :label="coursePositiveFeedbackLabel"
</div> class="mb-8"
<div class="mb-8"> />
<p class="mb-4">Was hat Ihnen besonders gut gefallen?</p> <!-- <button class="btn-blue" @click="sendFeedback">Senden und abschliessen</button>-->
<textarea <button class="btn-blue mr-4" :disabled="stepNo <= 0" @click="previousStep">
v-model="coursePositiveFeedback" Zurück
rows="4" </button>
class="block w-full rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" <button class="btn-blue" :disabled="stepNo >= MAX_STEPS - 1" @click="nextStep">
/> Weiter
<!-- class="block w-full rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"--> </button>
</div> <hr class="mb-10 mt-10" />
<button class="btn-blue" @click="sendFeedback">Senden und abschliessen</button>
<hr />
<pre> <pre>
satisfaction {{ satisfaction }} satisfaction {{ satisfaction }}
goalAttainment {{ goalAttainment }} goalAttainment {{ goalAttainment }}
@ -102,7 +100,7 @@ import {
YES_NO, YES_NO,
} from "@/components/learningPath/feedback.constants"; } from "@/components/learningPath/feedback.constants";
import ItRadioGroup from "@/components/ui/ItRadioGroup.vue"; import ItRadioGroup from "@/components/ui/ItRadioGroup.vue";
import { COMPLETION_SUCCESS } from "@/constants"; import ItTextarea from "@/components/ui/ItTextarea.vue";
import { graphql } from "@/gql/"; import { graphql } from "@/gql/";
import type { SendFeedbackInput } from "@/gql/graphql"; import type { SendFeedbackInput } from "@/gql/graphql";
import { useCircleStore } from "@/stores/circle"; import { useCircleStore } from "@/stores/circle";
@ -112,6 +110,9 @@ import log from "loglevel";
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
const { page } = defineProps<{ page: LearningContent }>(); const { page } = defineProps<{ page: LearningContent }>();
const instructorOpenFeedbackLabel = "Was ich dem Kursleiter sonst noch sagen wollte:";
const courseNegativeFeedbackLabel = "Wo sehen Sie Verbesserungspotenzial?";
const coursePositiveFeedbackLabel = "Was hat Ihnen besonders gut gefallen?";
const sendFeedbackMutation = graphql(` const sendFeedbackMutation = graphql(`
mutation SendFeedbackMutation($input: SendFeedbackInput!) { mutation SendFeedbackMutation($input: SendFeedbackInput!) {

View File

@ -0,0 +1,18 @@
<template>
<div class="border p-12">
<h2 class="text-5xl mb-12 leading-normal font-bold block">{{ label }}</h2>
<textarea
:value="modelValue"
class="w-full border-gray-500 h-40"
@input="$emit('update:modelValue', $event.target.value)"
/>
</div>
</template>
<script setup lang="ts">
defineProps<{
modelValue: string;
label: string;
}>();
defineEmits(["update:modelValue"]);
</script>

View File

@ -6,6 +6,7 @@ import ItCheckboxGroup from "@/components/ui/ItCheckboxGroup.vue";
import ItDropdown from "@/components/ui/ItDropdown.vue"; import ItDropdown from "@/components/ui/ItDropdown.vue";
import ItDropdownSelect from "@/components/ui/ItDropdownSelect.vue"; import ItDropdownSelect from "@/components/ui/ItDropdownSelect.vue";
import ItRadioGroup from "@/components/ui/ItRadioGroup.vue"; import ItRadioGroup from "@/components/ui/ItRadioGroup.vue";
import ItTextarea from "@/components/ui/ItTextarea.vue";
import logger from "loglevel"; import logger from "loglevel";
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
@ -94,6 +95,8 @@ const sourceItems = [
}, },
]; ];
const textValue = ref("abc");
function log(data: any) { function log(data: any) {
logger.info(data); logger.info(data);
} }
@ -409,6 +412,7 @@ function log(data: any) {
Click Me Click Me
</ItDropdown> </ItDropdown>
</div> </div>
<ItTextarea v-model="textValue" label="Hallo Velo" class="mb-8" />
<ItCheckboxGroup <ItCheckboxGroup
v-model="sourceValues" v-model="sourceValues"
:label="sourceLabel" :label="sourceLabel"