add color and routing

This commit is contained in:
2025-06-01 11:43:00 +02:00
parent 03e4a5790a
commit 87865871df
7 changed files with 93 additions and 22 deletions
+4 -3
View File
@@ -1,7 +1,7 @@
<template>
<div class="emphased">
<div v-for="(amount, val) in filtered_results" :id="`${questionId}-${val}`" :key="val"
:style="{ width: `${(amount / total) * 100}%` }">
:style="{ width: `${(amount / total) * 100}%`, background: colors[values.indexOf(val)] }">
<span>({{ amount }}){{ val }}</span>
</div>
</div>
@@ -12,11 +12,12 @@
interface Props {
values?: string[]
colors?: string[]
results: { [question_id: string]: { [values: string]: number } }
questionId: string
}
const { values = ["Très bien", "Bien", "Passable", "Insuffisant", "À rejeter"], results, questionId } = defineProps<Props>()
const { values = ["Très bien", "Bien", "Passable", "Insuffisant", "À rejeter"], colors = ["#4DB544", "#87E169", "#FFC33C", "#FF824B", "#E94A4D"], results, questionId } = defineProps<Props>()
const filtered_results = computed(() => {
if (!(questionId in results)) {
@@ -57,7 +58,7 @@ const total = computed(() => Object.values(filtered_results.value).reduce((acc,
.emphased:after {
content: "";
position: absolute;
z-index: -1;
z-index: 100;
top: -10px;
bottom: -10px;
left: 50%;