Add wrapper component for a question summary
Also add mobile version of the horizontal bar chart
This commit is contained in:
parent
2fd6201350
commit
c509deb092
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<QuestionSummary :title="props.title" :text="props.text">
|
||||
<div
|
||||
class="mb-10 grid grid-cols-horizontal-bar-chart grid-rows-horizontal-bar-chart overflow-hidden pt-[10px] grid-areas-horizontal-bar-chart"
|
||||
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"
|
||||
>
|
||||
<div class="-mt-[10px] flex flex-col justify-between pb-[30px] grid-in-y-axis">
|
||||
<span
|
||||
|
|
@ -25,15 +26,23 @@
|
|||
class="relative self-end bg-green-500 grid-in-right-chart"
|
||||
:style="greenStyle"
|
||||
></div>
|
||||
<div class="self-center justify-self-center font-bold grid-in-left-label">Nein</div>
|
||||
<div class="self-center justify-self-center font-bold grid-in-right-label">Ja</div>
|
||||
<div class="self-center justify-self-center font-bold grid-in-left-label">
|
||||
Nein
|
||||
</div>
|
||||
<div class="self-center justify-self-center font-bold grid-in-right-label">
|
||||
Ja
|
||||
</div>
|
||||
</div>
|
||||
</QuestionSummary>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import QuestionSummary from "@/components/ui/QuestionSummary.vue";
|
||||
import { computed } from "vue";
|
||||
const props = defineProps<{
|
||||
ratio: number;
|
||||
title: string;
|
||||
text: string;
|
||||
}>();
|
||||
|
||||
const ratio = computed(() => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<template>
|
||||
<div class="mb-8 p-6 md:p-8">
|
||||
<h3 class="text-xl font-normal">{{ props.title }}</h3>
|
||||
<h2 class="mb-6 text-xl font-bold">
|
||||
{{ props.text }}
|
||||
</h2>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
title: string;
|
||||
text: string;
|
||||
}>();
|
||||
</script>
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
<template>
|
||||
<div class="mb-8 p-8">
|
||||
<h3 class="text-xl font-normal">{{ props.title }}</h3>
|
||||
<h2 class="mb-6 text-xl font-bold">
|
||||
{{ props.text }}
|
||||
</h2>
|
||||
<QuestionSummary :title="props.title" :text="props.text">
|
||||
<div class="inline-grid grid-cols-[140px_auto] grid-rows-2 gap-x-2">
|
||||
<h4 class="text-xl">Durchschnitt:</h4>
|
||||
<h4 class="text-xl font-bold">Durchschnitt:</h4>
|
||||
<span
|
||||
class="col-start-2 row-span-2 inline-flex h-9 w-11 items-center justify-center rounded text-xl"
|
||||
:style="ratingValueStyle"
|
||||
|
|
@ -26,15 +22,22 @@
|
|||
:class="`legend-${legend.index}`"
|
||||
class="legend"
|
||||
>
|
||||
<div>{{ legend.index }}</div>
|
||||
<div
|
||||
:class="[{ hidden: legend.index === 3 || legend.index === 2 }, 'md:block']"
|
||||
>
|
||||
{{ legend.index }}
|
||||
</div>
|
||||
|
||||
<p>{{ legend.label }}</p>
|
||||
</div>
|
||||
<p :class="[{ hidden: legend.index === 3 || legend.index === 2 }, 'md:block']">
|
||||
{{ legend.label }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</QuestionSummary>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import QuestionSummary from "@/components/ui/QuestionSummary.vue";
|
||||
import { computed } from "vue";
|
||||
|
||||
type RGB = [number, number, number];
|
||||
|
|
|
|||
|
|
@ -481,11 +481,11 @@ function log(data: any) {
|
|||
title="Frage 9"
|
||||
text="Wie zufrieden bist du mit dem Kurs “Überbetriebliche Kurse” im Allgemeinen?"
|
||||
/>
|
||||
<HorizontalBarChart :ratio="0.5" />
|
||||
<HorizontalBarChart :ratio="0.8" />
|
||||
<HorizontalBarChart :ratio="0.2" />
|
||||
<HorizontalBarChart :ratio="2" />
|
||||
<HorizontalBarChart :ratio="0" />
|
||||
<HorizontalBarChart title="Frage X" text="Fragentext" :ratio="0.5" />
|
||||
<HorizontalBarChart title="Frage X" text="Fragentext" :ratio="0.8" />
|
||||
<HorizontalBarChart title="Frage X" text="Fragentext" :ratio="0.2" />
|
||||
<HorizontalBarChart title="Frage X" text="Fragentext" :ratio="2" />
|
||||
<HorizontalBarChart title="Frage X" text="Fragentext" :ratio="0" />
|
||||
</div>
|
||||
</main>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ module.exports = {
|
|||
},
|
||||
gridTemplateColumns: {
|
||||
"horizontal-bar-chart": "50px 1fr 300px 4fr 300px 1fr",
|
||||
"horizontal-bar-chart-slim": "50px 1fr 78px 4fr 78px 1fr",
|
||||
},
|
||||
gridTemplateRows: {
|
||||
"horizontal-bar-chart": "200px 40px",
|
||||
|
|
|
|||
Loading…
Reference in New Issue