Skip to content

Commit

Permalink
Mise à jour du composant Choice.vue et du fichier capitales.md, ajout…
Browse files Browse the repository at this point in the history
… du timer
  • Loading branch information
arthurbnu committed Mar 21, 2024
1 parent 474308c commit e16c52c
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 20 deletions.
35 changes: 35 additions & 0 deletions components/App/TimeProgress.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
<div class="h-2 opacity-60 flex rounded bg-teal-200/25">
<div class="w-full shadow-none rounded flex flex-col justify-center bg-teal-200 transition-all ease-linear"
:style="{'transition-duration' : time}"
:class="{'!w-0' : mounted}"
>
</div>
</div>
</template>

<script setup>
const mounted = ref(false)
const delay = 500
const emit = defineEmits(['end'])
const props = defineProps({
time : {
type: String,
required: false,
default: '3s'
}
})
onMounted( () => {
setTimeout(() => {
mounted.value = true
}, delay)
setTimeout(() => {
emit('end')
}, parseInt(props.time) * 1000 + delay)
})
</script>
8 changes: 7 additions & 1 deletion components/Quizz/Choice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
<div v-for="(pic, i) in picsRef" :key="i">
<div class="filter saturate-100 border-teal-600 border-solid" :class="{ 'border-b-2': currentIndex === i }">
<UAvatar :src="pic.src" :alt="pic.answer" size="lg" :imgClass="getImgClass(pic)"
@click="currentIndex = i" />
@click="currentIndex = (quizz.timer && !end) ? currentIndex : i" /> <!-- click on avatar to change pic - only if no timer -->
</div>
</div>
</div>
<!-- Questions -->
<div class="max-w-2xl m-auto">
<transition-scale v-if="quizz.timer" group class="block h-2" >
<template v-for="(pic, i) in picsRef" :key="i" >
<AppTimeProgress @end = "handleChoice(getChoices()[0])" v-if="currentIndex === i && ! alreadyAnswered(currentPic)"/>
</template>
</transition-scale>
<div class="bg-slate-800/40 p-2 pt-3 w-full rounded-lg relative" :class="quizz.small ? 'h-[42vh]' : 'h-[62vh]' ">
<div ref="imgContainer">
<transition-slide :offset="['100%', 0]" group mode="in-out">
Expand Down
1 change: 1 addition & 0 deletions content/quizz/capitales.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ hideTitle : true
small : true
badges : "culture, géographie"
icon: "i-lucide-globe"
timer: true
---


Expand Down
33 changes: 14 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,15 @@
dependencies:
"@iconify/utils" "^2.1.4"

"@esbuild/darwin-x64@0.18.20":
"@esbuild/win32-x64@0.18.20":
version "0.18.20"
resolved "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz"
integrity sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==
resolved "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz"
integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==

"@esbuild/darwin-x64@0.19.9":
"@esbuild/win32-x64@0.19.9":
version "0.19.9"
resolved "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.9.tgz"
integrity sha512-vE0VotmNTQaTdX0Q9dOHmMTao6ObjyPm58CHZr1UK7qpNleQyxlFlNCaHsHx6Uqv86VgPmR4o2wdNq3dP1qyDQ==
resolved "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.9.tgz"
integrity sha512-oxoQgglOP7RH6iasDrhY+R/3cHrfwIDvRlT4CGChflq6twk8iENeVvMJjmvBb94Ik1Z+93iGO27err7w6l54GQ==

"@fastify/accept-negotiator@^1.1.0":
version "1.1.0"
Expand Down Expand Up @@ -1042,11 +1042,6 @@
ufo "^1.3.2"
uncrypto "^0.1.3"

"@parcel/watcher-darwin-x64@2.3.0":
version "2.3.0"
resolved "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.3.0.tgz"
integrity sha512-20oBj8LcEOnLE3mgpy6zuOq8AplPu9NcSSSfyVKgfOhNAc4eF4ob3ldj0xWjGGbOF7Dcy1Tvm6ytvgdjlfUeow==

"@parcel/watcher-wasm@2.3.0":
version "2.3.0"
resolved "https://registry.npmjs.org/@parcel/watcher-wasm/-/watcher-wasm-2.3.0.tgz"
Expand All @@ -1056,6 +1051,11 @@
micromatch "^4.0.5"
napi-wasm "^1.1.0"

"@parcel/watcher-win32-x64@2.3.0":
version "2.3.0"
resolved "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.3.0.tgz"
integrity sha512-dLx+0XRdMnVI62kU3wbXvbIRhLck4aE28bIGKbRGS7BJNt54IIj9+c/Dkqb+7DJEbHUZAX1bwaoM8PqVlHJmCA==

"@parcel/watcher@^2.1.0", "@parcel/watcher@^2.3.0":
version "2.3.0"
resolved "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.3.0.tgz"
Expand Down Expand Up @@ -1187,10 +1187,10 @@
estree-walker "^2.0.2"
picomatch "^2.3.1"

"@rollup/rollup-darwin-x64@4.8.0":
"@rollup/rollup-win32-x64-msvc@4.8.0":
version "4.8.0"
resolved "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.8.0.tgz"
integrity sha512-A/FAHFRNQYrELrb/JHncRWzTTXB2ticiRFztP4ggIUAfa9Up1qfW8aG2w/mN9jNiZ+HB0t0u0jpJgFXG6BfRTA==
resolved "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.8.0.tgz"
integrity sha512-kb4/auKXkYKqlUYTE8s40FcJIj5soOyRLHKd4ugR0dCq0G2EfcF54eYcfQiGkHzjidZ40daB4ulsFdtqNKZtBg==

"@sigstore/bundle@^2.1.0":
version "2.1.0"
Expand Down Expand Up @@ -3627,11 +3627,6 @@ fs.realpath@^1.0.0:
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==

fsevents@~2.3.2, fsevents@~2.3.3:
version "2.3.3"
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==

function-bind@^1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
Expand Down

0 comments on commit e16c52c

Please sign in to comment.