@@ -2,47 +2,49 @@ import React from 'react';
22import Link from 'next/link' ;
33import parse from 'html-react-parser' ;
44
5- class BlogSection extends React . Component {
6- render ( ) {
7- const fromBlog = this . props . blogs ;
8- return (
9- < div className = "community-section" >
10- < div className = "community-head" >
11- { fromBlog . title_h2 && < h2 > { fromBlog . title_h2 } </ h2 > }
12- { fromBlog . view_articles && (
13- < Link href = { fromBlog . view_articles . href } >
14- < a className = "btn secondary-btn article-btn" >
15- { fromBlog . view_articles . title }
16- </ a >
17- </ Link >
18- ) }
19- </ div >
20- < div className = "home-featured-blogs" >
21- { fromBlog . featured_blogs . map ( ( blog , index ) => (
22- < div className = "featured-blog" key = { index } >
23- { blog . featured_image && (
24- < img
25- src = { blog . featured_image . url }
26- alt = { blog . featured_image . filename }
27- className = "blog-post-img"
28- />
5+ export default function BlogSection ( { fromBlog } ) {
6+ return (
7+ < div className = 'community-section' >
8+ < div className = 'community-head' >
9+ { fromBlog . title_h2 && (
10+ < h2 { ...fromBlog . $ ?. title_h2 } > { fromBlog . title_h2 } </ h2 >
11+ ) }
12+ { fromBlog . view_articles && (
13+ < Link href = { fromBlog . view_articles . href } >
14+ < a
15+ className = 'btn secondary-btn article-btn'
16+ { ...fromBlog . view_articles . $ ?. title }
17+ >
18+ { fromBlog . view_articles . title }
19+ </ a >
20+ </ Link >
21+ ) }
22+ </ div >
23+ < div className = 'home-featured-blogs' >
24+ { fromBlog . featured_blogs . map ( ( blog , index ) => (
25+ < div className = 'featured-blog' key = { index } >
26+ { blog . featured_image && (
27+ < img
28+ { ...blog . featured_image . $ ?. url }
29+ src = { blog . featured_image . url }
30+ alt = { blog . featured_image . filename }
31+ className = 'blog-post-img'
32+ />
33+ ) }
34+ < div className = 'featured-content' >
35+ { blog . title && < h3 { ...blog . $ ?. title } > { blog . title } </ h3 > }
36+ { typeof blog . body === 'string' && (
37+ < div > { parse ( blog . body . slice ( 0 , 300 ) ) } </ div >
38+ ) }
39+ { blog . url && (
40+ < Link href = { blog . url } passHref >
41+ < a className = 'blogpost-readmore' > { 'Read More -->' } </ a >
42+ </ Link >
2943 ) }
30- < div className = "featured-content" >
31- { blog . title && < h3 > { blog . title } </ h3 > }
32- { typeof blog . body === 'string' && (
33- < div > { parse ( blog . body . slice ( 0 , 300 ) ) } </ div >
34- ) }
35- { blog . url && (
36- < Link href = { blog . url } passHref >
37- < a className = "blogpost-readmore" > { 'Read More -->' } </ a >
38- </ Link >
39- ) }
40- </ div >
4144 </ div >
42- ) ) }
43- </ div >
45+ </ div >
46+ ) ) }
4447 </ div >
45- ) ;
46- }
48+ </ div >
49+ ) ;
4750}
48- export default BlogSection ;
0 commit comments