Guest User

Untitled

a guest
May 20th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import '../Assets/css/grayscale.css';
  3.  
  4. class Details extends Component {
  5. constructor(){
  6. super();
  7. this.state = {
  8. equipes:[]
  9. };
  10. }
  11.  
  12. componentDidMount(){
  13. fetch('http://api.football-data.org/v1/competitions/'+this.props.match.params.id+'/teams')
  14. .then(res => res.json())
  15. .then(res => {
  16. this.setState({
  17. equipes: res
  18. });
  19. })
  20. .catch(error => {
  21. console.log('error dude, desolé');
  22. })
  23. }
  24.  
  25. render () {
  26. console.log(this.state.equipes);
  27. return (
  28. <div>
  29. <header className="ligues">
  30. <div className="intro-body">
  31. <div className="container">
  32. <div className="row">
  33. <div className="col-lg-8 mx-auto">
  34. <h1 className="brand-heading">Ligues Football</h1>
  35. <a href="" className="btn btn-circle js-scroll-trigger">
  36. <i className="fa fa-angle-double-down animated"></i>
  37. </a>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </header>
  43. <h1>Teams Page</h1>
  44. <div className="row">
  45. {
  46. this.state.equipes.map(function(p, index){
  47. return(
  48. <div className="col-md-3">
  49. <div className="">
  50. <img className="card-img-top" src="https://cdn0.iconfinder.com/data/icons/cup/154/football-shield-club-sport-512.png" alt="Card image cap"/>
  51. <div className="card-body">
  52. <h5 className="card-title black"> {p.caption} </h5>
  53. </div>
  54. </div>
  55. </div>
  56. );
  57. })
  58. }
  59. </div>
  60. </div>
  61. );
  62. }
  63. }
  64.  
  65. export default Details;
Add Comment
Please, Sign In to add comment