Skip to content
Snippets Groups Projects
Select Git revision
  • 4cbdd53b5e2397cab2b5ee91da51ce5efde9cb9f
  • main default
  • tests
3 results

download_server.py

Blame
  • ToucanTable.js 1.10 KiB
    import React, {Component} from 'react'
    import {Table} from 'semantic-ui-react'
    import ToucanLine from './ToucanLine'
    
    class ToucanTable extends Component{
        constructor(){
            super();
            this.state = {
                toucans: [],
            }
        }
    
        componentDidMount(){
            fetch('/toucan/toucans')
            .then(result => {
                result.json()
                .then(toucans => {
                    this.setState({toucans})
                })
            })
        }
    
        render() {
            return(
                <Table celled padded collapsing size="small" textAlign="center">
                <Table.Header>
                  <Table.Row>
                    <Table.HeaderCell>Cover</Table.HeaderCell>
                    <Table.HeaderCell>Thème</Table.HeaderCell>
                    <Table.HeaderCell>Date</Table.HeaderCell>
                    <Table.HeaderCell>Supprimer</Table.HeaderCell>
                  </Table.Row>
                </Table.Header>
                  {this.state.toucans.map(toucan => {
                  return <ToucanLine key={toucan["_id"]} toucan={toucan}/>
                  })}
              </Table>
            )
        }
    }
    
    export default ToucanTable