Commit 25fb981d3e
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/AnnouncementsPanel.vue +27 −14
| @@ -38,10 +38,27 @@ const scrollRef = ref<HTMLElement>() | |||
| 38 | const showFade = ref(true) | 38 | const showFade = ref(true) |
| 39 | const panelStyle = ref<Record<string, string>>({}) | 39 | const panelStyle = ref<Record<string, string>>({}) |
| 40 | 40 | ||
| 41 | onClickOutside(wrapperRef, () => { | 41 | /* Type filter (gear menu) */ |
| 42 | // keep panel open while the filter menu is up | 42 | const typeFilter = ref('') |
| 43 | if (!filterOpen.value) isOpen.value = false | 43 | const filterOpen = ref(false) |
| 44 | }) | 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 | function onScroll() { | 63 | function 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 | ||
| 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 | function updateFilterPosition() { | 111 | function 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 */ |
| 135 | const activePost = ref<Announcement | null>(null) | ||
| 136 | 144 | ||
| 137 | function openPost(post: Announcement) { | 145 | function 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 { |