Skip to content

Instantly share code, notes, and snippets.

@hitchcockwill
Created October 3, 2017 15:37
Show Gist options
  • Save hitchcockwill/e38fd716beebdeee4bf0c871aafc81b5 to your computer and use it in GitHub Desktop.
Save hitchcockwill/e38fd716beebdeee4bf0c871aafc81b5 to your computer and use it in GitHub Desktop.
This is an actual description of a gist
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