diff --git a/src/components/Github.js b/src/components/Github.js new file mode 100644 index 0000000..4a6dba5 --- /dev/null +++ b/src/components/Github.js @@ -0,0 +1,47 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import './css/Github.css'; +import {getRepos} from '../actions'; + +class Github extends React.Component { + + componentDidMount() { + this.props.getRepos(); + console.log(this.props.repos); + } + + renderRepos() { + + if (this.props.repos) { + const render = this.props.repos.map((repo) =>{ + console.log(repo); + return ( +
+
{repo.name}
+

{repo.description}

+
+ ); + }); + console.log(render); + return
{render}
; + } + return
; + } + + render() { + return ( +
+

Github

+
+ {this.renderRepos()} +
+
+ ); + } +} + +const mapStateToProps = (state) => { + return { repos: state.github.repos}; +} + +export default connect(mapStateToProps, { getRepos })(Github); \ No newline at end of file diff --git a/src/components/css/Github.css b/src/components/css/Github.css new file mode 100644 index 0000000..678c019 --- /dev/null +++ b/src/components/css/Github.css @@ -0,0 +1,17 @@ +.repo { + display: flex; + flex-direction: column; + background-color: #DDDCDC; + border-radius: 10px; + padding: 10px; + align-items: center; + margin-top: 10px; +} + +.repo-list { + display:flex; + flex-direction: column; + width: 50vw; + margin-left: auto; + margin-right: auto; +} \ No newline at end of file