{"size": 1895, "ext": "js", "max_stars_repo_path": "src/components/StockTable/StockTable.js", "max_stars_repo_name": "pvijeh/stock-tracking-app-reactjs", "max_stars_repo_stars_event_min_datetime": "2017-03-27T01:42:07.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-29T07:12:39.000Z", "max_issues_repo_path": "src/components/StockTable/StockTable.js", "max_issues_repo_name": "pvijeh/stock-tracking-app-reactjs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/StockTable/StockTable.js", "max_forks_repo_name": "pvijeh/stock-tracking-app-reactjs", "max_forks_repo_forks_event_min_datetime": "2020-02-11T18:34:43.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-09T06:11:55.000Z"}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 25.6081081081, "max_line_length": 66, "alphanum_fraction": 0.5588390501}
/**
 * React Starter Kit (https://www.reactstarterkit.com/)
 *
 * Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */

import React, { Component } from 'react';
import {Table, Column, Cell } from '../fixed-data-table'; 
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './StockTable.scss'; 

const DateCell = ({rowIndex, data, col, ...props}) => (
  <Cell {...props}>
    {data.getObjectAt(rowIndex)[col].toLocaleString()}
  </Cell>
);

const TextCell = ({rowIndex, data, col, ...props}) => (
  <Cell {...props}>
    {data.getObjectAt(rowIndex)[col]}
  </Cell>
);

class StockTable extends Component {
  
  render() {

    let dataList = this.props.content;

    return (
      <Table
        rowHeight={50}
        headerHeight={50}
        rowsCount={dataList.getSize()}
        width={1000}
        height={500}
        {...this.props}>
        <Column
          header={<Cell>Product Name</Cell>}
          cell={<TextCell data={dataList} col="name" />}
          fixed={true}
          width={200}
        />
        <Column
          header={<Cell>Product Description</Cell>}
          cell={<TextCell data={dataList} col="description" />}
          fixed={true}
          width={400}
        />
        <Column
          header={<Cell>Price</Cell>}
          cell={<TextCell data={dataList} col="price" />}
          width={100}
        />
        <Column
          header={<Cell>Taxable? </Cell>}
          cell={<DateCell data={dataList} col="taxable" />}
          width={100}
        />
        <Column
          header={<Cell>Date Available</Cell>}
          cell={<DateCell data={dataList} col="date" />}
          width={200}
        />
      </Table>
    );
  }
}

export default withStyles(StockTable, s);
