@@ -162,6 +162,7 @@ function Post(props) {
162162 return subBlockContent
163163 }
164164
165+ // TODO: figure out how to add text formatting (bold, italic) to list items
165166 function formatListItem ( sectionChildren , markDefs ) {
166167 // console.log(`sectionChildren: `, sectionChildren)
167168 const listItem = [ ]
@@ -336,13 +337,17 @@ function Post(props) {
336337 </ Highlight >
337338 )
338339 }
340+
341+ function postBodyImage ( content ) {
342+ console . log ( 'content: ' , content )
343+ }
344+
339345 // TODO: test if list rendering works correctly with multiple lists in post
340346 let list = [ ]
341347 let listGroupKey = ''
342348 props . body && props . body . forEach ( ( section , i , arr ) => {
343-
349+ // console.log('section: ', section, '----\n')
344350 if ( section . listItem ) {
345- // console.log('section.listItem', section)
346351 list . push (
347352 < ListItem key = { section . _key } >
348353 { formatListItem ( section . children , section . markDefs ) }
@@ -367,6 +372,11 @@ function Post(props) {
367372
368373 if ( ! section . listItem ) {
369374 switch ( section . _type ) {
375+ case 'image' :
376+ postContent . push (
377+ postBodyImage ( section )
378+ )
379+ break
370380 case 'block' :
371381 postContent . push (
372382 paragraphBlock ( section )
@@ -480,6 +490,10 @@ export async function getStaticProps(context) {
480490 const post = await client . fetch ( `
481491 *[_type == "post" && slug.current == $slug][0]{
482492 ...,
493+ body[]{
494+ ...,
495+ asset->
496+ },
483497 "postImg": image.asset->,
484498 }
485499 ` , { slug } )
0 commit comments