@@ -267,6 +267,84 @@ export const Block: React.FC<Block> = props => {
267267 { renderChildText ( blockValue . properties . title ) }
268268 </ blockquote >
269269 ) ;
270+ case "collection_view" :
271+ if ( ! block ) return null ;
272+ const collectionView = block ?. collection ?. types [ 0 ] ;
273+
274+ return (
275+ < div >
276+ < h3 className = "notion-h3" >
277+ { renderChildText ( block . collection ?. title ! ) }
278+ </ h3 >
279+ { collectionView ?. type === "table" && (
280+ < div style = { { maxWidth : "100%" , marginTop : 5 } } >
281+ < table className = "notion-table" >
282+ < thead >
283+ < tr className = "notion-tr" >
284+ { collectionView . format ?. table_properties
285+ ?. filter ( p => p . visible )
286+ . map ( gp => (
287+ < th
288+ className = "notion-th"
289+ style = { { minWidth : gp . width } }
290+ >
291+ { block . collection ?. schema [ gp . property ] . name }
292+ </ th >
293+ ) ) }
294+ </ tr >
295+ </ thead >
296+ < tbody >
297+ { block ?. collection ?. data . map ( row => (
298+ < tr className = "notion-tr" >
299+ { collectionView . format ?. table_properties
300+ ?. filter ( p => p . visible )
301+ . map ( gp => (
302+ < td
303+ className = {
304+ "notion-td " +
305+ ( gp . property === "title" ? "notion-bold" : "" )
306+ }
307+ >
308+ {
309+ renderChildText (
310+ row [ block . collection ?. schema [ gp . property ] . name ! ]
311+ ) !
312+ }
313+ </ td >
314+ ) ) }
315+ </ tr >
316+ ) ) }
317+ </ tbody >
318+ </ table >
319+ </ div >
320+ ) }
321+ { collectionView ?. type === "gallery" && (
322+ < div className = "notion-gallery" >
323+ { block . collection ?. data . map ( ( row , i ) => (
324+ < div key = { `col-${ i } ` } className = "notion-gallery-card" >
325+ < div className = "notion-gallery-content" >
326+ { collectionView . format ?. gallery_properties
327+ ?. filter ( p => p . visible )
328+ . map ( ( gp , idx ) => (
329+ < p
330+ key = { idx + "item" }
331+ className = {
332+ "notion-gallery-data " +
333+ ( idx === 0 ? "is-first" : "" )
334+ }
335+ >
336+ { getTextContent (
337+ row [ block . collection ?. schema [ gp . property ] . name ! ]
338+ ) }
339+ </ p >
340+ ) ) }
341+ </ div >
342+ </ div >
343+ ) ) }
344+ </ div >
345+ ) }
346+ </ div >
347+ ) ;
270348 case "callout" :
271349 return (
272350 < div
0 commit comments