From fd3cecf5b5dc03a079b791779214d0bb722d9197 Mon Sep 17 00:00:00 2001
From: sayuri <smr17@inf.ufpr.br>
Date: Wed, 5 Jun 2019 12:02:20 -0300
Subject: [PATCH] =?UTF-8?q?requisi=C3=A7=C3=B5es=20prontas,=20carrosel=20q?=
 =?UTF-8?q?uebrado?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/Components/AreasSubPages.js | 44 +++++++++++++++++++--------------
 src/Components/Card.js          |  8 +++---
 2 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/src/Components/AreasSubPages.js b/src/Components/AreasSubPages.js
index 67b03f5a..b9953cf3 100644
--- a/src/Components/AreasSubPages.js
+++ b/src/Components/AreasSubPages.js
@@ -31,19 +31,35 @@ const areaStyle={
   minHeight: "150px"
 }
 
-class SubPages extends Component{
+class ReqCards extends Component{
   constructor(props){
     super(props);
-    
+    this.state = {
+      resources: [],
+    };
   }
-  getCards(){
+  componentWillMount(){
     axios.get(`${apiUrl}/learning_objects`+ '?limit=12&sort=["published_at", "desc"]')
-      .then(function(response){
-        console.log(response.data);
-      });
+    .then(res=> {
+      this.setState({resources: res.data});
+      console.log(res.data);
+    });
   }
+  render(){
+    return(
+      <Row>
+      {this.state.resources.map(card => <Col md={3} sm={6} key={card.id}><MediaCard name={card.name} description={card.description}/></Col>)}
+      </Row>
+    )
+  }
+}
+
+class SubPages extends Component{
+  constructor(props){
+    super(props);
+  }
+
   areaRender(){
-    this.getCards();
     switch(this.props.banner){
     case "Recursos":
       return(
@@ -62,21 +78,14 @@ class SubPages extends Component{
                 Recursos mais recentes </p>
               <Hidden sm xs>
               <Carousel showThumbs={false} autoPlay infiniteLoop={true} showStatus={false}>
+
+              <ReqCards/>
               </Carousel>
               </Hidden>
               <Visible sm xs>
               <Carousel showThumbs={false} infiniteLoop={true} showStatus={false}>
               <Row justify="around" style={{paddingBottom: "50px"}} >
-                {rows}
-                {rows}
-              </Row>
-              <Row justify="around" style={{paddingBottom: "50px"}} >
-                {rows}
-                {rows}
-              </Row>
-              <Row justify="around" style={{paddingBottom: "50px"}} >
-                {rows}
-                {rows}
+                <ReqCards/>
               </Row>
               </Carousel>
               </Visible>
@@ -137,7 +146,6 @@ class SubPages extends Component{
     return(
       <div>
       {this.areaRender()}
-
       </div>
   );
 }
diff --git a/src/Components/Card.js b/src/Components/Card.js
index 9e5e808b..1a41b00f 100644
--- a/src/Components/Card.js
+++ b/src/Components/Card.js
@@ -18,18 +18,16 @@ import thumbnail from "../img/girassol.jpg"
 //   },
 // };
 
-function RecipeReviewCard() {
-  // const classes = useStyles;
+function RecipeReviewCard(props){
   return (
     <Card>
       <img src={thumbnail} alt="thumbnail do recurso"/>
       <CardContent >
         <Typography variant="title" color="textSecondary" component="p">
-          Girassol
+          {props.name}
         </Typography>
         <Typography variant="caption" color="textSecondary" component="p">
-          This impressive paella is a perfect party dish and a fun meal to cook together with your
-          guests. Add 1 cup of frozen peas along with the mussels, if you like.
+          {props.description}
         </Typography>
       </CardContent>
       <CardActions>
-- 
GitLab