opnform-host-nginx/client/components/global/NotionPage.vue

92 lines
1.9 KiB
Vue
Raw Normal View History

2023-12-09 15:47:03 +01:00
<template>
<NotionRenderer
v-if="!loading"
:block-map="blocks"
:block-overrides="blockOverrides"
:content-id="contentId"
:full-page="fullPage"
:hide-list="hideList"
:level="level"
:map-image-url="mapImageUrl"
:map-page-url="mapPageUrl"
:page-link-options="pageLinkOptions"
:image-options="imageOptions"
:prism="prism"
:todo="todo"
/>
<div
v-else
class="p-6 flex items-center justify-center"
>
<loader class="w-6 h-6" />
2024-01-02 17:06:55 +01:00
</div>
2023-12-09 15:47:03 +01:00
</template>
<script>
import { NotionRenderer, defaultMapPageUrl, defaultMapImageUrl } from 'vue-notion'
2023-12-09 15:47:03 +01:00
export default {
name: 'NotionPage',
components: { NotionRenderer },
2023-12-09 15:47:03 +01:00
props: {
2024-01-02 17:06:55 +01:00
blockMap: {
type: Object
},
blockOverrides: {
type: Object,
default: () => ({})
2024-01-02 17:06:55 +01:00
},
loading: {
type: Boolean
},
contentId: String,
contentIndex: { type: Number, default: 0 },
fullPage: { type: Boolean, default: false },
hideList: { type: Array, default: () => [] },
level: { type: Number, default: 0 },
mapImageUrl: { type: Function, default: defaultMapImageUrl },
mapPageUrl: { type: Function, default: defaultMapPageUrl },
pageLinkOptions: {
type: Object, default: () => {
const NuxtLink = resolveComponent('NuxtLink')
return { component: NuxtLink, href: 'to' }
}
},
imageOptions: Object,
prism: { type: Boolean, default: false },
todo: { type: Boolean, default: false }
2023-12-09 15:47:03 +01:00
},
computed: {
blocks () {
if (this.blockMap && this.blockMap.data) {
return this.blockMap.data
}
return this.blockMap
}
}
2023-12-09 15:47:03 +01:00
}
</script>
<style lang='scss'>
@import "vue-notion/src/styles.css";
2023-12-09 15:47:03 +01:00
.notion-blue {
@apply text-nt-blue;
}
.notion-spacer {
width: 24px !important;
}
.notion-link {
text-decoration: none;
}
.notion {
img, iframe {
@apply rounded-md;
}
}
2023-12-09 15:47:03 +01:00
</style>