File tree Expand file tree Collapse file tree 3 files changed +18
-17
lines changed
src/shared/components/tc-communities/communities/blockchain/Learn Expand file tree Collapse file tree 3 files changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -38,9 +38,9 @@ Card.defaultProps = {
38
38
39
39
Card . propTypes = {
40
40
fullWidth : PT . bool ,
41
- item : {
41
+ item : PT . shape ( {
42
42
'content:encoded' : PT . string . isRequired ,
43
43
link : PT . string . isRequired ,
44
44
title : PT . string . isRequired ,
45
- } . isRequired ,
45
+ } ) . isRequired ,
46
46
} ;
Original file line number Diff line number Diff line change 2
2
* Renders the section with content from ConsenSys blog at Medium.
3
3
*/
4
4
5
+ import _ from 'lodash' ;
6
+ import LoadingIndicator from 'components/LoadingIndicator' ;
5
7
import PT from 'prop-types' ;
6
8
import React from 'react' ;
7
9
import Section from 'components/tc-communities/Section' ;
8
10
9
11
import Card from './Card' ;
10
12
import style from './style.scss' ;
11
13
12
-
13
14
export default function ConsenSysAtMedium ( { consenSysRss } ) {
14
- const cards = consenSysRss . data . item
15
+ let cards = _ . get ( consenSysRss , 'data.item' ) ;
16
+ cards = cards && cards
15
17
. filter ( item => Boolean ( item . category ) )
16
18
. slice ( 0 , 3 )
17
19
. map ( ( item , index ) => (
18
- < Card fullWidth = { ! index } item = { item } />
20
+ < Card fullWidth = { ! index } item = { item } key = { item . link } />
19
21
) ) ;
20
22
21
23
return (
@@ -25,15 +27,21 @@ export default function ConsenSysAtMedium({ consenSysRss }) {
25
27
} }
26
28
title = "ConsenSys @ Medium"
27
29
>
28
- { cards }
30
+ { cards || < LoadingIndicator /> }
29
31
</ Section >
30
32
) ;
31
33
}
32
34
35
+ ConsenSysAtMedium . defaultProps = {
36
+ consenSysRss : null ,
37
+ } ;
38
+
33
39
ConsenSysAtMedium . propTypes = {
34
40
consenSysRss : PT . shape ( {
35
41
data : PT . shape ( {
36
- item : PT . arrayOf ( PT . object ) . isRequired ,
37
- } ) . isRequired ,
38
- } ) . isRequired ,
42
+ item : PT . arrayOf ( PT . shape ( {
43
+ link : PT . string . isRequired ,
44
+ } ) ) . isRequired ,
45
+ } ) ,
46
+ } ) ,
39
47
} ;
Original file line number Diff line number Diff line change 6
6
*/
7
7
/* eslint-disable max-len */
8
8
9
- import LoadingIndicator from 'components/LoadingIndicator' ;
10
9
import PT from 'prop-types' ;
11
10
import React from 'react' ;
12
11
@@ -225,13 +224,7 @@ export default function Learn({
225
224
</ ul >
226
225
</ ArticleCard >
227
226
</ Section >
228
-
229
- {
230
- consenSysRss && consenSysRss . data ? (
231
- < ConsenSysAtMedium consenSysRss = { consenSysRss } />
232
- ) : < LoadingIndicator />
233
- }
234
-
227
+ < ConsenSysAtMedium consenSysRss = { consenSysRss } />
235
228
< Section
236
229
title = "More Resources"
237
230
theme = { {
You can’t perform that action at this time.
0 commit comments