Skip to content

Commit

Permalink
feat: toggle on outside click
Browse files Browse the repository at this point in the history
  • Loading branch information
ssiyad committed Sep 20, 2023
1 parent 4e447c8 commit e1f644e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions desk/src/components/notifications/Notifications.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<TransitionRoot
ref="target"
as="div"
class="fixed z-40 h-screen overflow-auto bg-white"
:show="notificationStore.visible"
Expand Down Expand Up @@ -72,6 +73,8 @@
</template>

<script setup lang="ts">
import { ref } from "vue";
import { onClickOutside } from "@vueuse/core";
import { TransitionRoot } from "@headlessui/vue";
import { dayjs } from "@/dayjs";
import { Notification } from "@/types";
Expand All @@ -82,6 +85,12 @@ import NotificationsMention from "./NotificationsMention.vue";
const notificationStore = useNotificationStore();
const sidebarStore = useSidebarStore();
const target = ref(null);
onClickOutside(target, () => {
if (notificationStore.visible) {
notificationStore.toggle();
}
});
function getBody(n: Notification) {
switch (n.notification_type) {
Expand Down

0 comments on commit e1f644e

Please sign in to comment.