New Landing Page v1.0 (#4463)

* Updated welcome landing page

* fixed test and linting

* linting

* addressing comments

* fix test

* fix test

* remove unneeded var

* add magic comments
This commit is contained in:
Hugh A. Miles II
2018-02-26 17:02:41 -08:00
committed by Maxime Beauchemin
parent 56f65158a2
commit 11ea83ecf1
7 changed files with 158 additions and 84 deletions

View File

@@ -1,9 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Table, Tr, Td } from 'reactable';
import { Collapse } from 'react-bootstrap';
import $ from 'jquery';
import '../../../stylesheets/reactable-pagination.css';
const propTypes = {
dataEndpoint: PropTypes.string.isRequired,
mutator: PropTypes.func,
@@ -29,7 +30,7 @@ export default class TableLoader extends React.PureComponent {
}
render() {
const tableProps = Object.assign({}, this.props);
let columns = this.props.columns;
let { columns } = this.props;
if (!columns && this.state.data.length > 0) {
columns = Object.keys(this.state.data[0]).filter(col => col[0] !== '_');
}
@@ -40,25 +41,21 @@ export default class TableLoader extends React.PureComponent {
return <img alt="loading" width="25" src="/static/assets/images/loading.gif" />;
}
return (
<Collapse in transitionAppear >
<div>
<Table {...tableProps}>
{this.state.data.map((row, i) => (
<Tr key={i}>
{columns.map((col) => {
if (row.hasOwnProperty('_' + col)) {
return (
<Td key={col} column={col} value={row['_' + col]}>
{row[col]}
</Td>);
}
return <Td key={col} column={col}>{row[col]}</Td>;
})}
</Tr>
))}
</Table>
</div>
</Collapse>
<Table {...tableProps} className="table" itemsPerPage={50} style={{ textTransform: 'capitalize' }}>
{this.state.data.map((row, i) => (
<Tr key={i}>
{columns.map((col) => {
if (row.hasOwnProperty('_' + col)) {
return (
<Td key={col} column={col} value={row['_' + col]}>
{row[col]}
</Td>);
}
return <Td key={col} column={col}>{row[col]}</Td>;
})}
</Tr>
))}
</Table>
);
}
}