display links to the stacked note

This commit is contained in:
Julien Calixte
2021-06-06 10:47:36 +02:00
parent 4f13c18573
commit c6dec8769f
6 changed files with 66 additions and 12 deletions

View File

@@ -1,19 +1,37 @@
<template>
<div class="linked-notes"></div>
<div v-if="(backlink?.links.length ?? 0) > 0" class="linked-notes">
<hr />
<h4 class="subtitle is-4">🔗 Links to this note</h4>
<ul>
<li v-for="link in backlink?.links" :key="link.sha">
{{ link.title }}
</li>
</ul>
</div>
</template>
<script lang="ts">
import { useBacklinks } from '@/hooks/useBacklinks.hook'
import { defineComponent } from 'vue'
export default defineComponent({
name: 'LinkedNotes',
props: {
sha: { type: String, required: true }
},
setup(props) {
const { backlink } = useBacklinks(props.sha)
return {
backlink: backlink.state
}
}
})
</script>
<style scoped lang="scss">
.linked-notes {
.subtitle {
font-style: italic;
}
}
</style>