Style VerticalbarChart
This commit is contained in:
parent
ec58ca176c
commit
956970ce5f
|
|
@ -1,7 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<QuestionSummary :title="props.title" :text="props.text">
|
<QuestionSummary :title="props.title" :text="props.text">
|
||||||
|
<h5 class="text-base mb-6">{{ answers }} {{ $t("feedback.answers") }}</h5>
|
||||||
<div
|
<div
|
||||||
class="mb-10 grid grid-cols-horizontal-bar-chart-slim grid-rows-horizontal-bar-chart overflow-hidden pt-[10px] grid-areas-horizontal-bar-chart md:grid-cols-horizontal-bar-chart"
|
class="grid grid-cols-horizontal-bar-chart-slim grid-rows-horizontal-bar-chart overflow-hidden pt-[10px] grid-areas-horizontal-bar-chart md:grid-cols-horizontal-bar-chart"
|
||||||
>
|
>
|
||||||
<div class="-mt-[10px] flex flex-col justify-between pb-[30px] grid-in-y-axis">
|
<div class="-mt-[10px] flex flex-col justify-between pb-[30px] grid-in-y-axis">
|
||||||
<span
|
<span
|
||||||
|
|
@ -27,20 +28,44 @@
|
||||||
:style="greenStyle"
|
:style="greenStyle"
|
||||||
></div>
|
></div>
|
||||||
<div class="self-center justify-self-center font-bold grid-in-left-label">
|
<div class="self-center justify-self-center font-bold grid-in-left-label">
|
||||||
Nein
|
<Popover class="relative">
|
||||||
|
<PopoverButton class="focus:outline-none">
|
||||||
|
{{ $t("general.no") }}
|
||||||
|
</PopoverButton>
|
||||||
|
<PopoverPanel
|
||||||
|
class="absolute top-[-200%] font-normal z-10 w-[120px] border border-gray-500 bg-white p-1 text-left text-sm"
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
{{ `"${$t('general.no')}" ${numberOfRatings["no"]} ${$t("feedback.answers")}` }}
|
||||||
|
</p>
|
||||||
|
</PopoverPanel>
|
||||||
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
<div class="self-center justify-self-center font-bold grid-in-right-label">
|
<div class="self-center justify-self-center font-bold grid-in-right-label">
|
||||||
Ja
|
<Popover class="relative">
|
||||||
|
<PopoverButton class="focus:outline-none">
|
||||||
|
{{ $t("general.yes") }}
|
||||||
|
</PopoverButton>
|
||||||
|
<PopoverPanel
|
||||||
|
class="absolute top-[-200%] font-normal z-10 w-[120px] border border-gray-500 bg-white p-1 text-left text-sm"
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
{{ `"${$t('general.yes')}" ${numberOfRatings["yes"]} ${$t("feedback.answers")}` }}
|
||||||
|
</p>
|
||||||
|
</PopoverPanel>
|
||||||
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</QuestionSummary>
|
</QuestionSummary>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { Popover, PopoverButton, PopoverPanel } from "@headlessui/vue";
|
||||||
import QuestionSummary from "@/components/ui/QuestionSummary.vue";
|
import QuestionSummary from "@/components/ui/QuestionSummary.vue";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
ratio: number;
|
ratio: number;
|
||||||
|
ratings: boolean[];
|
||||||
title: string;
|
title: string;
|
||||||
text: string;
|
text: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
@ -53,6 +78,17 @@ const redHeight = computed(() => {
|
||||||
return 1 - ratio.value;
|
return 1 - ratio.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const answers = computed(() => {
|
||||||
|
return props.ratings.length;
|
||||||
|
});
|
||||||
|
|
||||||
|
const numberOfRatings = computed(() => {
|
||||||
|
return {
|
||||||
|
yes: props.ratings.filter((rating) => rating).length,
|
||||||
|
no: props.ratings.filter((rating) => !rating).length,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const redStyle = {
|
const redStyle = {
|
||||||
height: `${100 * redHeight.value}%`,
|
height: `${100 * redHeight.value}%`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,9 @@
|
||||||
"certificate": "Zertifikat | Zertifikate",
|
"certificate": "Zertifikat | Zertifikate",
|
||||||
"notification": "Benachrichtigung | Benachrichtigungen",
|
"notification": "Benachrichtigung | Benachrichtigungen",
|
||||||
"profileLink": "Profil anzeigen",
|
"profileLink": "Profil anzeigen",
|
||||||
"shop": "Shop"
|
"shop": "Shop",
|
||||||
|
"yes": "Ja",
|
||||||
|
"no": "Nein"
|
||||||
},
|
},
|
||||||
"mainNavigation": {
|
"mainNavigation": {
|
||||||
"logout": "Abmelden",
|
"logout": "Abmelden",
|
||||||
|
|
|
||||||
|
|
@ -17,16 +17,19 @@
|
||||||
{{ $t("feedback.feedbackPageInfo") }}
|
{{ $t("feedback.feedbackPageInfo") }}
|
||||||
</p>
|
</p>
|
||||||
<ol v-if="Object.keys(feedbackData).length > 0">
|
<ol v-if="Object.keys(feedbackData).length > 0">
|
||||||
<li v-for="(question, i) in orderedQuestions" class="mb-8 bg-white p-8">
|
<li v-for="(question, i) in orderedQuestions">
|
||||||
<RatingScale
|
<RatingScale
|
||||||
v-if="ratingKeys.includes(question.key)"
|
v-if="ratingKeys.includes(question.key)"
|
||||||
|
class="bg-white mb-8"
|
||||||
:ratings="feedbackData.questions[question.key]"
|
:ratings="feedbackData.questions[question.key]"
|
||||||
:title="`${$t('feedback.questionTitle')} ${i}`"
|
:title="`${$t('feedback.questionTitle')} ${i}`"
|
||||||
:text="question.question"
|
:text="question.question"
|
||||||
/>
|
/>
|
||||||
<VerticalBarChart
|
<VerticalBarChart
|
||||||
|
class="bg-white mb-8"
|
||||||
v-else-if="verticalChartKyes.includes(question.key)"
|
v-else-if="verticalChartKyes.includes(question.key)"
|
||||||
:title="`${$t('feedback.questionTitle')} ${i}`"
|
:title="`${$t('feedback.questionTitle')} ${i}`"
|
||||||
|
:ratings="feedbackData.questions[question.key]"
|
||||||
:text="question.question"
|
:text="question.question"
|
||||||
:ratio="0.2"
|
:ratio="0.2"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue