feat: manage to get the popup to render with correct positions

This commit is contained in:
Twig 2025-07-18 11:00:25 +02:00
parent fe77b2c28d
commit 9d69dac77a
No known key found for this signature in database
2 changed files with 42 additions and 23 deletions

View file

@ -1,29 +1,25 @@
<template>
<div class="member-item" @click.prevent="createProfileModal(props.member)" tabindex="0">
<div class="member-item" @click.prevent="toggleModalPopup" tabindex="0">
<Avatar :profile="props.member" class="member-avatar"/>
<span class="member-display-name">{{ getDisplayName(props.member) }}</span>
</div>
<ModalProfilePopup v-if="modalPopupVisible"
:profile="props.member"/>
</template>
<script lang="ts" setup>
import { ModalProfilePopup } from '#components';
import { render } from 'vue';
import type { GuildMemberResponse } from '~/types/interfaces';
const props = defineProps<{
member: GuildMemberResponse
}>();
function createProfileModal(profile: GuildMemberResponse) {
const div = document.createElement("div");
const modal = h(ModalProfilePopup, {
profile: profile
});
document.body.appendChild(div);
render(modal, div);
}
const modalPopupVisible = ref<boolean>(false);
function toggleModalPopup() {
modalPopupVisible.value = !modalPopupVisible.value
}
</script>
<style>