Skip to content
Snippets Groups Projects
Select Git revision
  • b6e0560e8ea48b92a4a86739534884c61625cd67
  • master default
  • datenotunique
  • archives
  • lastToucanUrl
  • urltitle-year
  • lets-hope-for-the-best
  • everything-is-fine
  • feature/change-pdf-endpoint
9 results

ToucanTable.js

Blame
  • user avatar
    Damien authored
    b6e0560e
    History
    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