11import React from 'react' ;
22import './BlogList.css' ;
3- import Modal from 'react-awesome-modal' ;
43
54class BlogList extends React . Component {
65 constructor ( props ) {
@@ -23,7 +22,6 @@ class BlogList extends React.Component {
2322 return res . json ( ) ;
2423 } )
2524 . then ( resData => {
26- console . log ( resData ) ;
2725 for ( let i = 0 ; i < resData . items . length ; i ++ ) {
2826 let obj = { } ;
2927 obj . title = resData . items [ i ] . title ;
@@ -41,11 +39,6 @@ class BlogList extends React.Component {
4139 let reg = / < \s * p [ ^ > ] * > ( [ ^ < ] * ) < \s * \/ \s * p \s * > / ;
4240 let stream = resData . items [ i ] . content_encoded . match ( reg ) ;
4341
44- let div = document . createElement ( 'div' ) ;
45- div . innerHTML = resData . items [ i ] . content_encoded ;
46-
47- obj . longDescription = div . textContent || div . innerText || '' ;
48-
4942 obj . description =
5043 stream [ 1 ]
5144 . split ( ' ' )
@@ -61,25 +54,6 @@ class BlogList extends React.Component {
6154 } ) ;
6255 }
6356
64- handleClick = currentActivity => {
65- this . setState (
66- {
67- currentActivity : currentActivity
68- } ,
69- ( ) => {
70- this . setState ( {
71- visible : true
72- } ) ;
73- }
74- ) ;
75- } ;
76-
77- closeModal = ( ) => {
78- this . setState ( {
79- visible : false
80- } ) ;
81- } ;
82-
8357 render ( ) {
8458 return (
8559 < div className = 'mt-10' >
@@ -110,10 +84,9 @@ class BlogList extends React.Component {
11084 </ p >
11185
11286 < a
113- href = '#'
87+ href = { currentActivity . link }
11488 className = 'activity btn btn-outline-primary mt-auto btn-block align-self-end'
11589 style = { { marginTop : 'auto' } }
116- onClick = { ( ) => this . handleClick ( currentActivity ) }
11790 >
11891 Read More
11992 </ a >
@@ -127,54 +100,6 @@ class BlogList extends React.Component {
127100 </ section >
128101 </ div >
129102 </ main >
130- < Modal
131- visible = { this . state . visible }
132- width = '90%'
133- height = '90%'
134- effect = 'fadeInUp'
135- onClickAway = { ( ) => this . closeModal ( ) }
136- >
137- < div >
138- < img
139- src = {
140- this . state . currentActivity ? this . state . currentActivity . img : ''
141- }
142- style = { {
143- margin : '10px' ,
144- height : '200px' ,
145- objectFit : 'scale-down'
146- } }
147- > </ img >
148- < h2 style = { { padding : '10px' } } >
149- { this . state . currentActivity
150- ? this . state . currentActivity . title
151- : '' }
152- </ h2 >
153- < div style = { { width : '100%' , height : '100%' } } >
154- < p
155- style = { {
156- fontSize : '10' ,
157- overflow : 'auto' ,
158- display : 'block' ,
159- height : '450px' ,
160- margin : '10px'
161- } }
162- >
163- { this . state . currentActivity
164- ? this . state . currentActivity . longDescription
165- : '' }
166- </ p >
167- </ div >
168-
169- < button
170- type = 'button'
171- class = 'btn btn-danger btn-circle'
172- onClick = { this . closeModal }
173- >
174- < i class = 'fa fa-times' > </ i >
175- </ button >
176- </ div >
177- </ Modal >
178103 </ div >
179104 ) ;
180105 }
0 commit comments