Skip to content

Commit 00f8881

Browse files
committed
Update quiz flow and adjust QuestionAndAnswers spacing
Refactored App.vue to handle submitted state, showing QuestionAndAnswers without transition after submission. Also increased the gap between elements in QuestionAndAnswers.vue for improved layout.
1 parent c69c022 commit 00f8881

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

web/src/App.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import QuestionAndAnswers from './components/QuestionAndAnswers.vue';
66
import { BackendURL, AppSetting } from './main';
77
import QuizSteps from './components/QuizSteps.vue';
88
9-
const { question, loading, direction } = useGlobalState();
9+
const { question, loading, direction, submitted } = useGlobalState();
1010
</script>
1111

1212
<template>
@@ -17,10 +17,15 @@ const { question, loading, direction } = useGlobalState();
1717
<QuizSteps class="mt-2 w-full" />
1818
</div>
1919
</template>
20-
<div class="relative w-full h-full overflow-hidden p-3 sm:p-4">
21-
<Transition :name="direction === 'backward' ? 'swipe-right' : 'swipe-left'" mode="out-in" appear>
20+
<div class="overflow-hidden p-3 sm:p-4">
21+
<template v-if="!submitted">
22+
<Transition :name="direction === 'backward' ? 'swipe-right' : 'swipe-left'" mode="out-in" appear>
23+
<QuestionAndAnswers v-if="!loading && question" :question="question" :key="question.id" />
24+
</Transition>
25+
</template>
26+
<template v-else>
2227
<QuestionAndAnswers v-if="!loading && question" :question="question" :key="question.id" />
23-
</Transition>
28+
</template>
2429
</div>
2530
<template v-slot:footer>
2631
<Navigation class="p-3 sm:p-4" />
@@ -33,10 +38,6 @@ const { question, loading, direction } = useGlobalState();
3338
.swipe-left-leave-active,
3439
.swipe-right-enter-active,
3540
.swipe-right-leave-active {
36-
position: absolute;
37-
left: 0;
38-
right: 0;
39-
width: 100%;
4041
transition: all 0.18s cubic-bezier(0.6, 0.05, 0.2, 1);
4142
pointer-events: none;
4243
will-change: transform, opacity;

web/src/components/QuestionAndAnswers.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defineProps<{ question: QuestionAndAnswer }>();
66
</script>
77

88
<template>
9-
<div class="grid gap-4 lg:gap-6 text-center">
9+
<div class="grid gap-6 text-center">
1010
<div class="text-2xl font-semibold">{{ question.question }}</div>
1111

1212
<Answers :question="question" />

0 commit comments

Comments
 (0)