File tree Expand file tree Collapse file tree 4 files changed +23
-5
lines changed Expand file tree Collapse file tree 4 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
![ npm version] ( https://badgen.net/npm/v/react-notion ) ![ npm version] ( https://badgen.net/david/dep/splitbee/react-notion ) ![ minzipped sized] ( https://badgen.net/bundlephobia/minzip/react-notion )
4
4
5
-
6
5
A React renderer for Notion pages.
7
6
Use Notion as CMS for your blog, documentation or personal site.
8
7
@@ -111,14 +110,14 @@ Most common block types are supported. We happily accept pull requests to add su
111
110
| Link | ✅ Yes | |
112
111
| Code | ✅ Yes | |
113
112
| Web Bookmark | ✅ Yes | |
113
+ | Toggle List | ✅ Yes | |
114
114
| Databases | ❌ Missing | |
115
115
| Checkbox | ❌ Missing | |
116
- | Toggle List | ❌ Missing | |
117
116
| Table Of Contents | ❌ Missing | |
118
117
119
118
## Credits
120
119
121
120
- [ Tobias Lins] ( https://tobi.sh ) – Idea, Code
122
121
- [ Timo Lins] ( https://timo.sh ) – Code, Documentation
123
122
- [ samwightt] ( https://github.com/samwightt ) – Inspiration & API Typings
124
- - [ All people that contributed 💕] ( https://github.com/splitbee/react-notion/graphs/contributors )
123
+ - [ All people that contributed 💕] ( https://github.com/splitbee/react-notion/graphs/contributors )
Original file line number Diff line number Diff line change @@ -245,6 +245,13 @@ export const Block: React.FC<Block> = props => {
245
245
</ a >
246
246
</ div >
247
247
) ;
248
+ case "toggle" :
249
+ return (
250
+ < details className = "notion-toggle" >
251
+ < summary > { renderChildText ( blockValue . properties . title ) } </ summary >
252
+ < div > { children } </ div >
253
+ </ details >
254
+ ) ;
248
255
default :
249
256
if ( process . env . NODE_ENV !== "production" ) {
250
257
console . log ( "Unsupported type " + block ?. value ?. type ) ;
Original file line number Diff line number Diff line change 219
219
220
220
.notion-list li {
221
221
padding : 6px 0px ;
222
+ white-space : pre-wrap;
222
223
}
223
224
224
225
.notion-asset-wrapper {
232
233
233
234
.notion-text {
234
235
white-space : pre-wrap;
235
- word-break : break-word;
236
236
caret-color : rgb (55 , 53 , 47 );
237
237
}
238
238
.notion-block {
399
399
.notion-callout-text {
400
400
margin-left : 8px ;
401
401
}
402
+
403
+ .notion-toggle > div {
404
+ margin-left : 1.1em ;
405
+ }
Original file line number Diff line number Diff line change @@ -182,6 +182,13 @@ interface CalloutValueType extends BaseValueType {
182
182
} ;
183
183
}
184
184
185
+ interface ToggleValueType extends BaseValueType {
186
+ type : "toggle" ;
187
+ properties : {
188
+ title : DecorationType [ ] ;
189
+ } ;
190
+ }
191
+
185
192
export interface ContentValueType extends BaseValueType {
186
193
properties : {
187
194
source : string [ ] [ ] ;
@@ -238,7 +245,8 @@ export type BlockValueType =
238
245
| VideoValueType
239
246
| EmbedValueType
240
247
| CalloutValueType
241
- | BookmarkValueType ;
248
+ | BookmarkValueType
249
+ | ToggleValueType ;
242
250
243
251
export interface BlockType {
244
252
role : string ;
You can’t perform that action at this time.
0 commit comments