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 22
33![ 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 )
44
5-
65A React renderer for Notion pages.
76Use Notion as CMS for your blog, documentation or personal site.
87
@@ -111,14 +110,14 @@ Most common block types are supported. We happily accept pull requests to add su
111110| Link | ✅ Yes | |
112111| Code | ✅ Yes | |
113112| Web Bookmark | ✅ Yes | |
113+ | Toggle List | ✅ Yes | |
114114| Databases | ❌ Missing | |
115115| Checkbox | ❌ Missing | |
116- | Toggle List | ❌ Missing | |
117116| Table Of Contents | ❌ Missing | |
118117
119118## Credits
120119
121120- [ Tobias Lins] ( https://tobi.sh ) – Idea, Code
122121- [ Timo Lins] ( https://timo.sh ) – Code, Documentation
123122- [ 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 => {
245245 </ a >
246246 </ div >
247247 ) ;
248+ case "toggle" :
249+ return (
250+ < details className = "notion-toggle" >
251+ < summary > { renderChildText ( blockValue . properties . title ) } </ summary >
252+ < div > { children } </ div >
253+ </ details >
254+ ) ;
248255 default :
249256 if ( process . env . NODE_ENV !== "production" ) {
250257 console . log ( "Unsupported type " + block ?. value ?. type ) ;
Original file line number Diff line number Diff line change 219219
220220.notion-list li {
221221 padding : 6px 0px ;
222+ white-space : pre-wrap;
222223}
223224
224225.notion-asset-wrapper {
232233
233234.notion-text {
234235 white-space : pre-wrap;
235- word-break : break-word;
236236 caret-color : rgb (55 , 53 , 47 );
237237}
238238.notion-block {
399399.notion-callout-text {
400400 margin-left : 8px ;
401401}
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 {
182182 } ;
183183}
184184
185+ interface ToggleValueType extends BaseValueType {
186+ type : "toggle" ;
187+ properties : {
188+ title : DecorationType [ ] ;
189+ } ;
190+ }
191+
185192export interface ContentValueType extends BaseValueType {
186193 properties : {
187194 source : string [ ] [ ] ;
@@ -238,7 +245,8 @@ export type BlockValueType =
238245 | VideoValueType
239246 | EmbedValueType
240247 | CalloutValueType
241- | BookmarkValueType ;
248+ | BookmarkValueType
249+ | ToggleValueType ;
242250
243251export interface BlockType {
244252 role : string ;
You can’t perform that action at this time.
0 commit comments