-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reducing the amount of data being pulled into components, from the fu…
…ll `record` to just certain properties.
- Loading branch information
1 parent
f56bb0d
commit d5c50a2
Showing
6 changed files
with
25 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
|
||
const RecommendedResource = ({ record }) => { | ||
const isRecommended = record.fields.some((item) => { | ||
return item.uid === 'highly_recommended'; | ||
const RecommendedResource = ({ fields = [] }) => { | ||
const isRecommended = fields.some(({ uid }) => { | ||
return uid === 'highly_recommended'; | ||
}); | ||
|
||
return isRecommended ? <span className='recommended-resource-tag strong'>Recommended</span> : null; | ||
}; | ||
|
||
RecommendedResource.propTypes = { | ||
record: PropTypes.object | ||
fields: PropTypes.array | ||
}; | ||
|
||
export default RecommendedResource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters