import React from "react";

import { Table } from "../../../atoms/table";
import { Card, CardBody } from "../../../atoms/card";

const Thead = (props) => (
  <thead>
    <tr>
      {props.headers.map((header) => (
        <th scope="col">{header}</th>
      ))}
    </tr>
  </thead>
);

const Tbody = (props) => (
  <tbody>
    {props.row.map((row) => (
      <tr>
        {row.map((column) => (
          <td>{column}</td>
        ))}
      </tr>
    ))}
  </tbody>
);

const TableCard = (props) => {
  return (
    <Card {...props}>
      <CardBody>
      <Table {...props}>
        <Thead {...props} />
        <Tbody {...props} />
      </Table>
      </CardBody>
    </Card>
  );
};

export default TableCard;
