import React, { useState } from "react";
import { Transition } from "../../../atoms/base";
import { Table, Tr } from "../../../atoms/table";
import { DividerStart } from "../../../atoms/divider";
import { Small, P } from "../../../atoms/base";
import { Card, CardBody } from "../../../atoms/card";

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

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

const Menu = (props) => {
  return (
    <Card {...props}>
      <CardBody>
        <P ml2 textWeightBold>{props.title}</P>
        <Table noborder>
          <Thead {...props} />
          <Tbody {...props} />
        </Table>
      </CardBody>
    </Card>
  );
};

export default Menu;
