From cd9b802b71df4e2701e2311b2995fe70a9692ae4 Mon Sep 17 00:00:00 2001 From: Renard Date: Mon, 16 Sep 2019 01:22:56 -0300 Subject: Prettier --- src/Home.js | 227 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 133 insertions(+), 94 deletions(-) (limited to 'src/Home.js') diff --git a/src/Home.js b/src/Home.js index 8493db2..4544cf2 100644 --- a/src/Home.js +++ b/src/Home.js @@ -6,105 +6,144 @@ import "moment/locale/es"; import { Link } from "@reach/router"; class Home extends Component { - constructor() { - super(); - this.state = { - lastAgeThreads: [], - newThreadsList: [], - latestNews: [], - isLoaded: false - } - } - - componentDidMount() { - fetch("https://bienvenidoainternet.org/cgi/api/lastage?limit=10") - .then((response) => { return response.json() }) - .then((resource) => { - this.setState({ - lastAgeThreads: resource["threads"] - }) - }); + constructor() { + super(); + this.state = { + lastAgeThreads: [], + newThreadsList: [], + latestNews: [], + isLoaded: false + }; + } - fetch("https://bienvenidoainternet.org/cgi/api/newThreads?limit=10") - .then((response) => { return response.json() }) - .then((resource) => { - this.setState({ - newThreadsList: resource["threads"], - }); - }); + componentDidMount() { + fetch("https://bienvenidoainternet.org/cgi/api/lastage?limit=10") + .then(response => { + return response.json(); + }) + .then(resource => { + this.setState({ + lastAgeThreads: resource["threads"] + }); + }); - fetch("https://bienvenidoainternet.org/cgi/api/blotter") - .then((response) => { return response.json() }) - .then((resource) => { - this.setState({ - latestNews: resource["news"], - isLoaded: true - }); - }); - } + fetch("https://bienvenidoainternet.org/cgi/api/newThreads?limit=10") + .then(response => { + return response.json(); + }) + .then(resource => { + this.setState({ + newThreadsList: resource["threads"] + }); + }); - render() { - if (!this.state.isLoaded) { - return ( - - Cargando ... - - ) - } + fetch("https://bienvenidoainternet.org/cgi/api/blotter") + .then(response => { + return response.json(); + }) + .then(resource => { + this.setState({ + latestNews: resource["news"], + isLoaded: true + }); + }); + } - const { newThreadsList, lastAgeThreads, latestNews } = this.state; + render() { + if (!this.state.isLoaded) { + return ( + + Cargando ... + + ); + } - return ( - - - -
Hilos activos
- - {lastAgeThreads.map(thread => - - - - {thread.content} - {thread.board_fulln} ― - - - )} - -
- -
Nuevos hilos
- - {newThreadsList.map(thread => - - - - {thread.content} - {thread.board_fulln} ― - - - )} - -
-
- - -
Blotter
- - {latestNews.map(n => - - -
- + const { newThreadsList, lastAgeThreads, latestNews } = this.state; - - - )} - - - - - ); - } + return ( + + + +
Hilos activos
+ + {lastAgeThreads.map(thread => ( + + + + + {thread.content} + + + {thread.board_fulln} ―{" "} + + + + + + ))} + +
+ +
Nuevos hilos
+ + {newThreadsList.map(thread => ( + + + + + {thread.content} + + + {thread.board_fulln} ―{" "} + + + + + + ))} + +
+
+ + +
Blotter
+ + {latestNews.map(n => ( + + +
+ + + + + + + ))} + + + + + ); + } } -export default Home; \ No newline at end of file +export default Home; -- cgit v1.2.1-18-gbd029