import * as React from 'react'; import { Tips, Logo } from "./Utils"; import * as Papa from 'papaparse'; const readCsv = require('react-csv'); const CSVLink = readCsv.CSVLink; // Import React Table import ReactTable from 'react-table'; import "react-table/react-table.css"; export class ServerTable extends React.Component { constructor(props: any) { super(props); this.state = { data: [] // data:makeData() }; this.loaded = this.loaded.bind(this); Papa.parse('/data.csv', { header: true, download: true, skipEmptyLines: true, complete: this.loaded }); } public render() { const { data } = this.state; const filterExact = (filter: any, row: any) => String(row[filter.id]) === filter.value; const filterPart = (filter: any, row: any) => row[filter.id].startsWith(filter.value) || row[filter.id].endsWith(filter.value) return (
d.lastName } ] }, { Header: "Info", columns: [{ Header: 'Profile Progress', accessor: 'progress', Cell: (row: any) => (
66 ? '#85cc00' : row.value > 33 ? '#ffbf00' : '#ff2e00', borderRadius: '2px', transition: 'all .2s ease-out' }} />
) }, { Header: "Age", accessor: "age" }, { Header: "Status", accessor: "status" } ] }, { Header: 'Stats', columns: [ { Header: "Visits", accessor: "visits" } ] } ]} defaultPageSize={20} className="-striped -highlight" />
Click here to download CSV file
); } public loaded(results: any) { this.setState({ data: results.data }); } }