Created
October 3, 2017 15:37
-
-
Save hitchcockwill/e38fd716beebdeee4bf0c871aafc81b5 to your computer and use it in GitHub Desktop.
This is an actual description of a gist
This file contains hidden or 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
import React, { Component } from 'react' | |
import PropTypes from 'prop-types' | |
import Gist from './GistItem' | |
import './gistsList.css' | |
class GistsList extends Component { | |
static propTypes = { | |
activeGist: PropTypes.string, | |
gists: PropTypes.array, | |
username: PropTypes.string, | |
onSelect: PropTypes.func, | |
} | |
render() { | |
const { activeGist, gists, onSelect } = this.props | |
return ( | |
<div className="gistsList"> | |
{ !gists.length && | |
<p className="error">No gists were found for that user. This probably means that the user does not have any gists or does not exist.</p> | |
} | |
{ gists.map((gist) => { | |
return ( | |
<Gist | |
key={gist.id} | |
gist={gist} | |
onSelect={onSelect} | |
activeGist={activeGist} | |
/> | |
) | |
}) | |
} | |
</div> | |
) | |
} | |
} | |
export default GistsList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment