assembly/composables/useBackdrop.ts

17 lines
367 B
TypeScript
Raw Normal View History

2021-07-26 18:33:52 +00:00
import { computed } from "@nuxtjs/composition-api";
import { useSidebar } from "./useSidebar";
export function useBackdrop() {
const { isOpen: isSidbarOpen, close: closeSidbar } = useSidebar();
const isShown = computed(() => isSidbarOpen.value);
function close() {
if (isSidbarOpen.value) {
closeSidbar();
}
}
return { isShown, close };
}