Commit 25fb981d3e

25fb981d3e20474387d50234ee54c355b0777ea1

parent: 457e895080

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-07-26 13:01 UTC

Update AnnouncementsPanel.vue

Layout: unified · split

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