Skip to content

Commit 5368e88

Browse files
authored
Merge pull request #64 from janniks/add-checkboxes
Add checkboxes
2 parents c080f12 + 55476b6 commit 5368e88

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ Most common block types are supported. We happily accept pull requests to add su
187187
| Page Links | ✅ Yes | |
188188
| Cover | ✅ Yes | Enable with `fullPage` |
189189
| Equations | ✅ Yes | |
190+
| Checkbox | ✅ Yes | |
190191
| Databases | ❌ Not planned | |
191-
| Checkbox | ❌ Not planned | |
192192
| Table Of Contents | ❌ Not planned | |
193193

194194
Please, feel free to [open an issue](https://github.com/janniks/vue-notion/issues/new) if you notice any important blocks missing or anything wrong with existing blocks.

dev/serve.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default {
2222
async created() {
2323
// react-notion tester: 2e22de6b770e4166be301490f6ffd420
2424
// equation tester: 2a1d5226d68246deba627012081693f9
25+
// todo tester: 235057194b954a60ace89c052a65d102
2526
this.blockMap = await getPageBlocks("2e22de6b770e4166be301490f6ffd420");
2627
},
2728
};

src/blocks/todo.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<template>
2+
<div>
3+
<input
4+
type="checkbox"
5+
:value="title"
6+
:checked="properties.checked"
7+
disabled="disabled"
8+
/>
9+
<label>
10+
<NotionTextRenderer :text="title" v-bind="pass" />
11+
</label>
12+
</div>
13+
</template>
14+
15+
<script>
16+
// TODO: add notion styling
17+
// TODO: add strikethrough
18+
19+
import Blockable from "@/lib/blockable";
20+
import NotionTextRenderer from "@/blocks/helpers/text-renderer";
21+
22+
export default {
23+
extends: Blockable,
24+
name: "NotionTodo",
25+
components: {
26+
NotionTextRenderer,
27+
},
28+
};
29+
</script>

src/components/block.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<template>
22
<div v-if="isType('page')">
3-
<NotionPage v-bind="pass"><slot /></NotionPage>
3+
<NotionPage v-bind="pass">
4+
<slot />
5+
</NotionPage>
46
</div>
57
<NotionHeader
68
v-else-if="isType(['header', 'sub_header', 'sub_sub_header'])"
@@ -12,6 +14,7 @@
1214
<NotionEquation v-else-if="isType('equation')" v-bind="pass" />
1315
<NotionText v-else-if="isType('text')" v-bind="pass" />
1416
<NotionQuote v-else-if="isType('quote')" v-bind="pass" />
17+
<NotionTodo v-else-if="isType('to_do')" v-bind="pass" />
1518
<NotionToggle v-else-if="isType('toggle')" v-bind="pass">
1619
<slot />
1720
</NotionToggle>
@@ -32,7 +35,10 @@
3235
v-bind="pass"
3336
/>
3437
<hr v-else-if="isType('divider')" class="notion-hr" />
35-
<div v-else-if="todo && visible">todo: {{ type }}<slot /></div>
38+
<div v-else-if="todo && visible">
39+
todo: {{ type }}
40+
<slot />
41+
</div>
3642
<!-- todo: maybe add message on !production if block type unsupported -->
3743
<!-- <div v-else-if="visible"><slot /></div> -->
3844
</template>
@@ -51,6 +57,7 @@ import NotionText from "@/blocks/text";
5157
import NotionToggle from "@/blocks/toggle";
5258
import NotionQuote from "@/blocks/quote";
5359
import NotionEquation from "@/blocks/equation";
60+
import NotionTodo from "@/blocks/todo";
5461
5562
export default {
5663
extends: Blockable,
@@ -68,6 +75,7 @@ export default {
6875
NotionToggle,
6976
NotionQuote,
7077
NotionEquation,
78+
NotionTodo,
7179
},
7280
};
7381
</script>

0 commit comments

Comments
 (0)