Skip to content

Commit 48e1193

Browse files
committed
Add close button to InfoModal
1 parent 06e1d2c commit 48e1193

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

pcd-website/src/components/InfoModal.vue

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { ref, watch, nextTick, onUnmounted, computed } from 'vue';
33
import { useI18n } from 'vue-i18n';
4+
import { Icon } from '@iconify/vue';
45
import { createFocusTrap, type FocusTrap } from 'focus-trap';
56
import fallbackBannerImage from '../images/community_background_2x.png?url';
67
@@ -60,6 +61,13 @@ onUnmounted(() => {
6061
:aria-label="t('nav.info_modal_title')"
6162
class="info-modal"
6263
>
64+
<button
65+
class="info-modal-close"
66+
:aria-label="t('nav.info_modal_back_to_map')"
67+
@click="handleClose()"
68+
>
69+
<Icon icon="bi:x-lg" width="1.125em" height="1.125em" aria-hidden="true" />
70+
</button>
6371
<img
6472
:src="bannerImage"
6573
class="info-modal-banner"
@@ -111,6 +119,33 @@ onUnmounted(() => {
111119
overflow: hidden;
112120
}
113121
122+
.info-modal-close {
123+
position: absolute;
124+
top: var(--spacing-sm);
125+
right: var(--spacing-sm);
126+
z-index: 1;
127+
width: 32px;
128+
height: 32px;
129+
display: flex;
130+
align-items: center;
131+
justify-content: center;
132+
background: rgba(0, 0, 0, 0.35);
133+
color: #fff;
134+
border: none;
135+
border-radius: 50%;
136+
cursor: pointer;
137+
transition: background-color 0.15s ease;
138+
}
139+
140+
.info-modal-close:hover {
141+
background: rgba(0, 0, 0, 0.55);
142+
}
143+
144+
.info-modal-close:focus-visible {
145+
outline: 2px solid var(--color-focus);
146+
outline-offset: 2px;
147+
}
148+
114149
.info-modal-banner {
115150
display: block;
116151
width: 100%;

0 commit comments

Comments
 (0)