|
| 1 | +<template> |
| 2 | + <Modal v-if="show"> |
| 3 | + <article class="style-card bg-secondary max-w-screen-md w-full"> |
| 4 | + <div class="card overflow-scroll max-h-[80vh]"> |
| 5 | + <div class="flex justify-center"> |
| 6 | + <TagIcon class="w-12 h-12 m-4 text-accent" /> |
| 7 | + </div> |
| 8 | + <h2 class="text-heading-2 mb-box text-center"> |
| 9 | + {{ t("Headings.SelectSkill") }} |
| 10 | + </h2> |
| 11 | + <div class="flex justify-center mb-4"> |
| 12 | + <p class="max-w-md text-center"> |
| 13 | + {{ t("Body.SelectSkillDescription")}} |
| 14 | + </p> |
| 15 | + </div> |
| 16 | + <div |
| 17 | + v-for="(skill, index) in skills" |
| 18 | + :key="index" |
| 19 | + class="flex gap-card" |
| 20 | + > |
| 21 | + <article |
| 22 | + class="w-full grid grid-cols-1 gap-y-1 border-2 rounded-md py-2 px-4 mt-box cursor-pointer" |
| 23 | + :class=" |
| 24 | + selectedSkill === skill.id |
| 25 | + ? 'border-accent' |
| 26 | + : 'border-transparent bg-primary' |
| 27 | + " |
| 28 | + @click="selectSkill(skill.id)" |
| 29 | + > |
| 30 | + <p class="text-body-1">{{ skill.name }}</p> |
| 31 | + </article> |
| 32 | + </div> |
| 33 | + </div> |
| 34 | + <div class="card flex gap-card flex-wrap bg-[#1c3250]"> |
| 35 | + <Btn secondary @click="closeModal"> |
| 36 | + {{ t("Buttons.Cancel") }} |
| 37 | + </Btn> |
| 38 | + <div class="flex-1"></div> |
| 39 | + <Btn |
| 40 | + :disabled="!selectedSkill" |
| 41 | + class="disabled:opacity-25" |
| 42 | + @click="confirmSelection" |
| 43 | + > |
| 44 | + {{ t("Buttons.Next") }} |
| 45 | + </Btn> |
| 46 | + </div> |
| 47 | + </article> |
| 48 | + </Modal> |
| 49 | +</template> |
| 50 | + |
| 51 | +<script lang="ts"> |
| 52 | +import { defineComponent, ref } from "vue"; |
| 53 | +import { useI18n } from "vue-i18n"; |
| 54 | +import Modal from "@/components/Dialog.vue"; |
| 55 | +import Btn from "@/components/Btn.vue"; |
| 56 | +import { TagIcon } from "@heroicons/vue/24/outline"; |
| 57 | +
|
| 58 | +export default defineComponent({ |
| 59 | + components: { Modal, Btn, TagIcon }, |
| 60 | + props: { |
| 61 | + show: { type: Boolean, default: false }, |
| 62 | + skills: { |
| 63 | + type: Array as PropType<Array<{ id: string; name: string }>>, |
| 64 | + default: () => [], |
| 65 | + }, |
| 66 | + }, |
| 67 | + emits: ["select", "close"], |
| 68 | + setup(props, { emit }) { |
| 69 | + const { t } = useI18n(); |
| 70 | + const selectedSkill = ref<string | null>(null); |
| 71 | +
|
| 72 | + function selectSkill(skillID: string) { |
| 73 | + selectedSkill.value = skillID; |
| 74 | + } |
| 75 | +
|
| 76 | + function confirmSelection() { |
| 77 | + if (!selectedSkill.value) return; |
| 78 | +
|
| 79 | + emit("select", selectedSkill.value); |
| 80 | + closeModal(); |
| 81 | + } |
| 82 | +
|
| 83 | + function closeModal() { |
| 84 | + emit("close"); |
| 85 | + } |
| 86 | +
|
| 87 | + return { |
| 88 | + t, |
| 89 | + selectedSkill, |
| 90 | + selectSkill, |
| 91 | + confirmSelection, |
| 92 | + closeModal, |
| 93 | + }; |
| 94 | + }, |
| 95 | +}); |
| 96 | +</script> |
0 commit comments