(stacked notes) implements overlay

This commit is contained in:
2021-03-14 15:21:14 +01:00
parent cd381f9c4a
commit 698c865b39
6 changed files with 172 additions and 45 deletions

View File

@@ -0,0 +1,27 @@
import { computed, onMounted } from '@vue/runtime-core'
import { useOverlay } from '@/hooks/useOverlay.hook'
const BOOKMARK_WIDTH = 2
const NOTE_WIDTH = 620
export const useNoteOverlay = (className: string, index: number) => {
const { x } = useOverlay()
const displayNoteOverlay = computed(() => x.value > index * NOTE_WIDTH)
onMounted(() => {
const noteElement = document.querySelector(
`.${className}`
) as HTMLElement | null
if (!noteElement) {
return
}
noteElement.style.left = `${(index + 1) * BOOKMARK_WIDTH}rem`
})
return {
displayNoteOverlay
}
}