Commit 25fb981d3e
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/AnnouncementsPanel.vue +27 −14
| @@ -38,10 +38,27 @@ const scrollRef = ref<HTMLElement>() | ||
| 38 | 38 | const showFade = ref(true) |
| 39 | 39 | const panelStyle = ref<Record<string, string>>({}) |
| 40 | 40 | |
| 41 | onClickOutside(wrapperRef, () => { | |
| 42 | // keep panel open while the filter menu is up | |
| 43 | if (!filterOpen.value) isOpen.value = false | |
| 44 | }) | |
| 41 | /* Type filter (gear menu) */ | |
| 42 | const typeFilter = ref('') | |
| 43 | const filterOpen = ref(false) | |
| 44 | const filterBtnRef = ref<HTMLElement>() | |
| 45 | const filterMenuRef = ref<HTMLElement>() | |
| 46 | const filterStyle = ref<Record<string, string>>({}) | |
| 47 | ||
| 48 | /* Detail popup */ | |
| 49 | const activePost = ref<Announcement | null>(null) | |
| 50 | const backdropRef = ref<HTMLElement>() | |
| 51 | ||
| 52 | onClickOutside( | |
| 53 | wrapperRef, | |
| 54 | () => { | |
| 55 | // keep panel open while the filter menu or detail popup is up | |
| 56 | if (!filterOpen.value && !activePost.value) isOpen.value = false | |
| 57 | }, | |
| 58 | { | |
| 59 | ignore: [filterMenuRef, backdropRef] | |
| 60 | } | |
| 61 | ) | |
| 45 | 62 | |
| 46 | 63 | function onScroll() { |
| 47 | 64 | if (!scrollRef.value) return |
| @@ -91,14 +108,6 @@ useEventListener(inBrowser ? window : undefined, 'resize', () => { | ||
| 91 | 108 | if (filterOpen.value) updateFilterPosition() |
| 92 | 109 | }) |
| 93 | 110 | |
| 94 | /* Type filter (gear menu) */ | |
| 95 | // '' = all types | |
| 96 | const typeFilter = ref('') | |
| 97 | const filterOpen = ref(false) | |
| 98 | const filterBtnRef = ref<HTMLElement>() | |
| 99 | const filterMenuRef = ref<HTMLElement>() | |
| 100 | const filterStyle = ref<Record<string, string>>({}) | |
| 101 | ||
| 102 | 111 | function updateFilterPosition() { |
| 103 | 112 | const btn = filterBtnRef.value |
| 104 | 113 | if (!btn) return |
| @@ -132,7 +141,6 @@ const filtered = computed(() => | ||
| 132 | 141 | ) |
| 133 | 142 | |
| 134 | 143 | /* Detail popup */ |
| 135 | const activePost = ref<Announcement | null>(null) | |
| 136 | 144 | |
| 137 | 145 | function openPost(post: Announcement) { |
| 138 | 146 | markRead(post.id) |
| @@ -274,7 +282,7 @@ onUnmounted(() => { | ||
| 274 | 282 | <!-- detail popup --> |
| 275 | 283 | <Teleport to="body"> |
| 276 | 284 | <Transition name="ann-detail-fade"> |
| 277 | <div v-if="activePost" class="ann-backdrop" @click.self="closePost"> | |
| 285 | <div v-if="activePost" ref="backdropRef" class="ann-backdrop" @click.self="closePost"> | |
| 278 | 286 | <Transition name="ann-detail-slide" appear> |
| 279 | 287 | <div v-if="activePost" class="ann-detail" role="dialog" aria-modal="true" :aria-label="activePost.title"> |
| 280 | 288 | <div class="ann-detail-head"> |
| @@ -770,8 +778,13 @@ html.effects-disabled .ann-detail-close:active { | ||
| 770 | 778 | transform: translateY(8px); |
| 771 | 779 | } |
| 772 | 780 | |
| 781 | .ann-filter-menu { | |
| 782 | z-index: 10000; | |
| 783 | } | |
| 784 | ||
| 773 | 785 | .ann-backdrop { |
| 774 | 786 | align-items: stretch; |
| 787 | z-index: 10001; | |
| 775 | 788 | } |
| 776 | 789 | |
| 777 | 790 | .ann-detail { |