-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f7966c
commit 9393086
Showing
3 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script setup lang="ts"> | ||
const props = defineProps<{ score: number; total: number }>(); | ||
const { score, total } = toRefs(props); | ||
const percentage = computed(() => (score.value / total.value) * 100); | ||
const sentence = computed(() => { | ||
if (percentage.value === 100) { | ||
return 'Congratulations! You got a perfect score!'; | ||
} | ||
if (percentage.value > 80) { | ||
return 'Great job!'; | ||
} | ||
if (percentage.value > 50) { | ||
return 'Good effort!'; | ||
} | ||
if (percentage.value > 25) { | ||
return 'You can do better!'; | ||
} | ||
return 'If you would have answered randomly, you would have scored better!'; | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<h1 class="text-3xl font-bold">You scored {{ score }}/{{ total }}</h1> | ||
<p class="text-lg my-8 text-gray-400">{{ sentence }}</p> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters