exit button for adventurer details popup

This commit is contained in:
2023-04-07 22:22:26 +02:00
parent 4f2d742284
commit 19d3dd5515
2 changed files with 53 additions and 15 deletions
+50 -14
View File
@@ -1,17 +1,18 @@
<template> <template>
<dialog ref="modal" class="adventurer-details" v-if="adventurer"> <dialog ref="modal" class="adventurer-details" v-if="adventurer">
<button class="close" @click="$emit('closeButtonClicked')"></button>
<div class="adventurer-portrait"> <div class="adventurer-portrait">
<img :src="adventurer.portrait" alt="" draggable="false"/> <img :src="adventurer.portrait" alt="" draggable="false"/>
</div> </div>
<span class="name">{{ adventurer.name }}</span> <span class="name">{{ adventurer.name }}</span>
<div class="adventurer-data"> <div class="adventurer-data">
<p>Level: {{ adventurer.level }} / {{ adventurer.getMaxLevel() }}</p> <p>Level: {{ adventurer.level }} / {{ adventurer.getMaxLevel() }}</p>
<p>Prestige level: {{ adventurer.prestige }}</p> <p>Prestige level: {{ adventurer.prestige }}</p>
<p>Exp: {{ adventurer.exp }} / {{ adventurer.getNextLevelExpRequirement()}}</p> <p>Exp: {{ adventurer.exp }} / {{ adventurer.getNextLevelExpRequirement() }}</p>
<p>DPS: {{ adventurer.getDPS().toPrecision(2) }}</p> <p>DPS: {{ adventurer.getDPS().toPrecision(2) }}</p>
</div> </div>
</dialog> </dialog>
</template> </template>
@@ -24,16 +25,16 @@ export default defineComponent({
name: "AdventurerDetails", name: "AdventurerDetails",
props: { props: {
adventurer: { adventurer: {
type: Object as PropType<Adventurer|null>, type: Object as PropType<Adventurer | null>,
default() { default() {
return null as Adventurer|null; return null as Adventurer | null;
}, },
required: true, required: true,
}, },
}, },
mounted() { mounted() {
const refs = this.$refs as any; const refs = this.$refs as any;
refs.modal.showModal(); refs.modal.showModal();
}, },
}); });
@@ -42,6 +43,7 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
.adventurer-details { .adventurer-details {
display: flex; display: flex;
position: absolute;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@@ -52,19 +54,51 @@ export default defineComponent({
background-position: center; background-position: center;
background-size: cover; background-size: cover;
user-select: none; user-select: none;
&::backdrop { &::backdrop {
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
} }
.close {
position: absolute;
top: 0.25rem;
right: 0.5rem;
display: flex;
justify-content: center;
align-items: center;
font-size: 3rem;
margin: 0;
cursor: pointer;
color: #ab0707;
background: transparent;
border: none;
font-family: 'EB Garamond', serif;
&:hover {
color: #ff0000;
}
&:focus {
outline: none;
}
&:focus-visible {
outline: 2px solid #ff0000;
}
}
.adventurer-portrait { .adventurer-portrait {
width: 100%; width: 100%;
max-width: 15rem; max-width: 15rem;
aspect-ratio: 1/1; aspect-ratio: 1/1;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
} }
} }
.name { .name {
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -72,6 +106,7 @@ export default defineComponent({
font-weight: bold; font-weight: bold;
width: 100%; width: 100%;
} }
.adventurer-data { .adventurer-data {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@@ -80,6 +115,7 @@ export default defineComponent({
flex-wrap: wrap; flex-wrap: wrap;
font-size: 1.2rem; font-size: 1.2rem;
width: 100%; width: 100%;
& > * { & > * {
margin: 0; margin: 0;
width: calc(50% - 1rem); width: calc(50% - 1rem);
+3 -1
View File
@@ -3,6 +3,7 @@
<AdventurerDetails <AdventurerDetails
:adventurer="selectedAdventurer" :adventurer="selectedAdventurer"
v-if="selectedAdventurer !== null" v-if="selectedAdventurer !== null"
@closeButtonClicked="selectedAdventurer = null"
/> />
<section class="recruit panel pinned-paper"> <section class="recruit panel pinned-paper">
@@ -85,7 +86,7 @@ export default defineComponent({
required: true, required: true,
}, },
adventurerForHire: { adventurerForHire: {
type: Object as PropType<Adventurer|null>, type: Object as PropType<Adventurer | null>,
default() { default() {
return null; return null;
} }
@@ -148,6 +149,7 @@ export default defineComponent({
flex-direction: column; flex-direction: column;
gap: 0.25rem; gap: 0.25rem;
font-size: 1.1rem; font-size: 1.1rem;
cursor: pointer;
.entry { .entry {
height: 7rem; height: 7rem;