covidassist/src/views/Questionnaire.vue

53 lines
1.4 KiB
Vue
Raw Normal View History

2020-03-21 16:19:14 +01:00
<template>
<div class="questionmaire">
2020-03-21 22:28:01 +01:00
<div class="progress">
2020-03-22 00:02:03 +01:00
<div v-bind:key="n" v-for="n in $store.state.questions.length" v-bind:class="getDotClass(n)"></div>
2020-03-21 22:28:01 +01:00
</div>
2020-03-21 18:57:15 +01:00
<Question
2020-03-22 14:21:58 +01:00
v-bind:type="$store.state.questions[$route.params.id].type"
v-bind:question="$store.state.questions[$route.params.id].question"
v-bind:answers="$store.state.questions[$route.params.id].answers"></Question>
2020-03-21 16:19:14 +01:00
</div>
</template>
<script>
import Question from "@/components/Question";
export default {
name: "Questionnaire",
2020-03-21 20:20:55 +01:00
components: {Question},
2020-03-21 22:28:01 +01:00
methods: {
getDotClass(n) {
2020-03-22 14:21:58 +01:00
if (n <= this.$route.params.id) {
2020-03-21 22:28:01 +01:00
return "point answered"
} else {
return "point"
}
}
},
2020-03-21 16:19:14 +01:00
}
</script>
<style scoped>
2020-03-21 22:28:01 +01:00
.progress {
2020-03-21 23:14:44 +01:00
margin-top: 1em;
2020-03-21 22:28:01 +01:00
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
}
.point {
margin: 0.2em;
width: 0.5em;
height: 0.5em;
border-radius: 50%;
background: transparent;
border: 2px solid #23286b;
user-select: none;
cursor: pointer;
}
.point.answered {
background-color: #23286b;
}
2020-03-21 16:19:14 +01:00
</style>