From 5382ed028c7ec554f760affa7f533b15421959c9 Mon Sep 17 00:00:00 2001 From: Renard Date: Wed, 11 Sep 2019 19:54:48 -0300 Subject: First commit --- src/App.js | 99 +++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 24 deletions(-) (limited to 'src/App.js') diff --git a/src/App.js b/src/App.js index ce9cbd2..701e140 100644 --- a/src/App.js +++ b/src/App.js @@ -1,26 +1,77 @@ -import React from 'react'; -import logo from './logo.svg'; -import './App.css'; - -function App() { - return ( -
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
-
- ); +import React, { Component } from 'react'; +import { render } from "react-dom"; +import { Router, Link, Match } from "@reach/router"; +import 'fomantic-ui-css/semantic.css'; +import "./App.css"; + +import { Dropdown, Menu, Icon, Loader, Container, Grid } from "semantic-ui-react"; +import Home from "./Home"; +import BBSThread from "./BBSThread"; +import Board from "./Board"; +import NotFound from "./NotFound" + +class App extends Component { + constructor() { + super(); + this.state = { + boardList: [], + isLoaded: false + } + + } + + componentDidMount() { + fetch("https://bienvenidoainternet.org/cgi/api/boards") + .then((response) => { + return response.json(); + }) + .then((resource) => { + this.setState({ boardList: resource["boards"], isLoaded: true }); + }) + .catch(console.error); + } + + render() { + if (!this.state.isLoaded) { + if (!this.state.isLoaded) { + return ( + + Cargando ... + + ) + } + } + + const { boardList } = this.state; + const pathList = boardList.map(board => "/" + board.dir) + return ( + + + B.a.I + Home + + + {boardList.map(board => board.board_type === 1 ? /{board.dir}/ - {board.name} : null)} + + + + + {boardList.map(board => board.board_type === 0 ? /{board.dir}/ - {board.name} : null)} + + + + + + + + + + + + + ); + } } -export default App; + +render(, document.getElementById("root")); \ No newline at end of file -- cgit v1.2.1-18-gbd029