提交正式官网
This commit is contained in:
@@ -0,0 +1,152 @@
|
||||
<script setup lang="ts">
|
||||
import { freeAssessmentContentBundle } from '~/data/free-assessment-content'
|
||||
|
||||
const content = useLocalized(freeAssessmentContentBundle)
|
||||
const freeAssessmentForm = computed(() => content.value.form)
|
||||
|
||||
const open = defineModel<boolean>({ default: false })
|
||||
|
||||
function close() {
|
||||
open.value = false
|
||||
}
|
||||
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape' && open.value) {
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
||||
watch(open, (isOpen) => {
|
||||
if (import.meta.client) {
|
||||
document.body.style.overflow = isOpen ? 'hidden' : ''
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
document.addEventListener('keydown', onKeydown)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('keydown', onKeydown)
|
||||
if (import.meta.client) {
|
||||
document.body.style.overflow = ''
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="fa-modal">
|
||||
<div
|
||||
v-if="open"
|
||||
class="fa-modal"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
:aria-label="freeAssessmentForm.title"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="fa-modal__backdrop"
|
||||
aria-label="Close assessment form"
|
||||
@click="close"
|
||||
/>
|
||||
<div class="fa-modal__panel">
|
||||
<button
|
||||
type="button"
|
||||
class="fa-modal__close"
|
||||
aria-label="Close"
|
||||
@click="close"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h2 class="fa-modal__title">{{ freeAssessmentForm.title }}</h2>
|
||||
<FreeAssessmentForm variant="embedded" @submitted="close" />
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.fa-modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
.fa-modal__backdrop {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: rgba(15, 39, 64, 0.55);
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.fa-modal__panel {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
max-width: 880px;
|
||||
max-height: calc(100vh - 48px);
|
||||
overflow-y: auto;
|
||||
background: #fff;
|
||||
border: 1px solid #e3ecf5;
|
||||
border-radius: var(--radius);
|
||||
padding: 36px 44px 44px;
|
||||
box-shadow: var(--shadow-lg);
|
||||
}
|
||||
.fa-modal__close {
|
||||
position: absolute;
|
||||
top: 14px;
|
||||
right: 16px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28px;
|
||||
line-height: 1;
|
||||
color: #0f2740;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: background 0.18s ease, color 0.18s ease;
|
||||
}
|
||||
.fa-modal__close:hover {
|
||||
background: var(--bg-soft);
|
||||
color: var(--blue);
|
||||
}
|
||||
.fa-modal__title {
|
||||
text-align: center;
|
||||
font-size: clamp(22px, 2.8vw, 26px);
|
||||
font-weight: 800;
|
||||
color: #0f2740;
|
||||
margin: 0 0 28px;
|
||||
padding-right: 32px;
|
||||
}
|
||||
|
||||
.fa-modal-enter-active,
|
||||
.fa-modal-leave-active {
|
||||
transition: opacity 0.22s ease;
|
||||
}
|
||||
.fa-modal-enter-active .fa-modal__panel,
|
||||
.fa-modal-leave-active .fa-modal__panel {
|
||||
transition: transform 0.22s ease;
|
||||
}
|
||||
.fa-modal-enter-from,
|
||||
.fa-modal-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
.fa-modal-enter-from .fa-modal__panel,
|
||||
.fa-modal-leave-to .fa-modal__panel {
|
||||
transform: translateY(12px) scale(0.98);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.fa-modal__panel {
|
||||
padding: 28px 20px 32px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user