dummy html cleaned

This commit is contained in:
Luis Fernando Molina committed 2018-09-06 07:55:01 +02:00
1 parent 153dbf9663
commit 327bfcc038
7 files changed
+3 -219

No files matched your search

+3 -33
View File
@@ -1,45 +1,15 @@
import React, { Component } from 'react'
import axios from 'axios'
import { Link } from 'react-router-dom'
import Pokeball from '../pokeball.png'
class Search extends Component {
state = {
posts: []
}
componentDidMount(){
axios.get('https://jsonplaceholder.typicode.com/posts/')
.then(res => {
this.setState({
posts: res.data.slice(0,10)
});
})
}
render(){
const { posts } = this.state
const postList = posts.length ? (
posts.map(post => {
return (
<div className="post card" key={post.id}>
<img src={Pokeball} alt="A Pokeball" />
<div className="card-content">
<Link to={'/' + post.id}>
<span className="card-title red-text">{post.title}</span>
</Link>
<p>{post.body}</p>
</div>
</div>
)
})
) : (
<div className="center">No posts to show</div>
);
render(){
return (
<div>
<div className="container home">
<h4 className="center">Search</h4>
{postList}
<div>
</div>
</div>
)