Skip to content

Commit 90eed23

Browse files
committed
A couple more fixes for Blockchain community's Learn page
1 parent 3a1b77f commit 90eed23

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

src/shared/components/tc-communities/communities/blockchain/Learn/ConsenSysAtMedium/Card/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ Card.defaultProps = {
3838

3939
Card.propTypes = {
4040
fullWidth: PT.bool,
41-
item: {
41+
item: PT.shape({
4242
'content:encoded': PT.string.isRequired,
4343
link: PT.string.isRequired,
4444
title: PT.string.isRequired,
45-
}.isRequired,
45+
}).isRequired,
4646
};

src/shared/components/tc-communities/communities/blockchain/Learn/ConsenSysAtMedium/index.jsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22
* Renders the section with content from ConsenSys blog at Medium.
33
*/
44

5+
import _ from 'lodash';
6+
import LoadingIndicator from 'components/LoadingIndicator';
57
import PT from 'prop-types';
68
import React from 'react';
79
import Section from 'components/tc-communities/Section';
810

911
import Card from './Card';
1012
import style from './style.scss';
1113

12-
1314
export default function ConsenSysAtMedium({ consenSysRss }) {
14-
const cards = consenSysRss.data.item
15+
let cards = _.get(consenSysRss, 'data.item');
16+
cards = cards && cards
1517
.filter(item => Boolean(item.category))
1618
.slice(0, 3)
1719
.map((item, index) => (
18-
<Card fullWidth={!index} item={item} />
20+
<Card fullWidth={!index} item={item} key={item.link} />
1921
));
2022

2123
return (
@@ -25,15 +27,21 @@ export default function ConsenSysAtMedium({ consenSysRss }) {
2527
}}
2628
title="ConsenSys @ Medium"
2729
>
28-
{cards}
30+
{cards || <LoadingIndicator />}
2931
</Section>
3032
);
3133
}
3234

35+
ConsenSysAtMedium.defaultProps = {
36+
consenSysRss: null,
37+
};
38+
3339
ConsenSysAtMedium.propTypes = {
3440
consenSysRss: PT.shape({
3541
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+
}),
3947
};

src/shared/components/tc-communities/communities/blockchain/Learn/index.jsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
/* eslint-disable max-len */
88

9-
import LoadingIndicator from 'components/LoadingIndicator';
109
import PT from 'prop-types';
1110
import React from 'react';
1211

@@ -225,13 +224,7 @@ export default function Learn({
225224
</ul>
226225
</ArticleCard>
227226
</Section>
228-
229-
{
230-
consenSysRss && consenSysRss.data ? (
231-
<ConsenSysAtMedium consenSysRss={consenSysRss} />
232-
) : <LoadingIndicator />
233-
}
234-
227+
<ConsenSysAtMedium consenSysRss={consenSysRss} />
235228
<Section
236229
title="More Resources"
237230
theme={{

0 commit comments

Comments
 (0)