Added delete-quiz-button

This commit is contained in:
Mawoka
2022-09-01 18:10:34 +02:00
parent 857f26aada
commit 258e8089a4
+24 -6
View File
@@ -16,7 +16,6 @@
const { t } = getLocalization();
export let quizzes;
/*
const deleteQuiz = async (to_delete: string) => {
if (!confirm('Do you really want to delete this quiz?')) {
return;
@@ -26,8 +25,6 @@
});
window.location.reload();
};
*/
</script>
<div class="w-screen p-8">
@@ -125,8 +122,8 @@
<span>{$t('words.private')}</span>
{/if}
</div>
<div class="flex justify-center pb-20 pt-8">
<div class="flex flex-col gap-4">
<div class="flex justify-center pb-10 pt-8">
<div class="flex flex-col gap-3">
<a
href="/edit?quiz_id={quiz.id}"
class="px-4 py-2 leading-5 text-black dark:text-white transition-colors duration-200 transform bg-gray-50 dark:bg-gray-700 rounded text-center hover:bg-gray-300 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:hover:bg-gray-600"
@@ -140,9 +137,30 @@
>
{$t('words.start')}
</button>
<button
on:click={() => {
deleteQuiz(quiz.id);
}}
class="py-2 w-full flex justify-center text-black dark:text-white transition-colors duration-200 transform bg-gray-50 dark:bg-gray-700 rounded text-center hover:bg-gray-300 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:hover:bg-gray-600"
>
<!-- heroicons/trash -->
<svg
class="w-5 h-5"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
/>
</svg>
</button>
</div>
</div>
<div class="flex justify-center" />
</SwiperSlide>
{#each quiz.questions as question}
<SwiperSlide>