|
1 | 1 | <script setup lang="ts"> |
2 | | -import { useNotionBlock, defineNotionProps } from "@/lib/blockable" |
3 | | -import NotionTextRenderer from "@/blocks/helpers/text-renderer.vue" |
| 2 | +import { useNotionBlock, defineNotionProps } from "@/lib/blockable"; |
| 3 | +import NotionHeaderRenderer from "@/blocks/helpers/header-renderer.vue"; |
| 4 | +import NotionRenderer from "@/components/notion-renderer.vue"; |
4 | 5 |
|
5 | | -const props = defineProps({ ...defineNotionProps }) |
| 6 | +const props = defineProps({ ...defineNotionProps }); |
6 | 7 | //@ts-ignore |
7 | | -const { type, title, pass, block } = useNotionBlock(props) |
| 8 | +const { type, title, pass, block, format } = useNotionBlock(props); |
8 | 9 | </script> |
9 | 10 |
|
10 | 11 | <script lang="ts"> |
11 | 12 | export default { |
12 | 13 | name: "NotionHeader", |
13 | | -} |
| 14 | +}; |
14 | 15 | </script> |
15 | 16 |
|
16 | 17 | <template> |
17 | | - <h1 class="notion-h1" :id="block.value.id" v-if="type === 'header'"> |
18 | | - <NotionTextRenderer :text="title" v-bind="pass" /> |
19 | | - </h1> |
20 | | - <h2 class="notion-h2" :id="block.value.id" v-else-if="type === 'sub_header'"> |
21 | | - <NotionTextRenderer :text="title" v-bind="pass" /> |
22 | | - </h2> |
23 | | - <h3 class="notion-h3" :id="block.value.id" v-else-if="type === 'sub_sub_header'"> |
24 | | - <NotionTextRenderer :text="title" v-bind="pass" /> |
25 | | - </h3> |
| 18 | + <details v-if="format?.toggleable" class="notion-toggle"> |
| 19 | + <summary><NotionHeaderRenderer class="notion-h" v-bind="pass"></NotionHeaderRenderer></summary> |
| 20 | + <div> |
| 21 | + <NotionRenderer |
| 22 | + v-for="(contentId, contentIndex) in block.value.content" |
| 23 | + v-bind="pass" |
| 24 | + :key="contentId" |
| 25 | + :level="pass.level + 1" |
| 26 | + :content-id="contentId" |
| 27 | + :content-index="contentIndex" |
| 28 | + ></NotionRenderer> |
| 29 | + </div> |
| 30 | + </details> |
| 31 | + <NotionHeaderRenderer v-else v-bind="pass"></NotionHeaderRenderer> |
26 | 32 | </template> |
0 commit comments