(notes) add routing between notes

This commit is contained in:
2021-03-13 22:11:58 +01:00
parent 2bb43ac961
commit 8fad931dfd
12 changed files with 343 additions and 65 deletions

View File

@@ -0,0 +1,40 @@
<template>
<div class="stacked-note" v-html="content"></div>
</template>
<script lang="ts">
import { defineComponent, nextTick, watch } from 'vue'
import { useFile } from '@/hooks/useFile.hook'
import { useLinks } from '@/hooks/useLinks.hook'
export default defineComponent({
name: 'StackedNote',
props: {
user: { type: String, required: true },
repo: { type: String, required: true },
sha: { type: String, required: true }
},
setup(props) {
const { content } = useFile(props.user, props.repo, props.sha)
const { listenToClick } = useLinks('stacked-note', props.sha)
watch(content, () => {
if (content.value) {
nextTick(() => {
listenToClick()
})
}
})
return { content }
}
})
</script>
<style lang="scss" scoped>
.stacked-note {
text-align: left;
border-left: 1px solid rgba(18, 19, 58, 0.2);
padding-left: 1rem;
}
</style>