import React from "react";
import PropTypes from "prop-types";
import classNames from "classnames";

import DiscloseRow from "./Row";

/**
 *
 * @param {Object} props - Properties passed to component
 * @returns {ReactElement}
 */

let DiscloseTable = ({
    children,
    className,
    testSection,
    ...props
}) => {
    return (
        <table
            data-oui-component={true}
            className={classNames("oui-disclose-table", className)}
            style={{ tableLayout: "auto" }}
            data-test-section={testSection}
            {...props}
        >
            {children}
        </table>
    );
};

DiscloseTable.propTypes = {
    /** Should be a `Table.THead` or `Table.TBody` */
    children: PropTypes.node.isRequired,
    /** CSS class names. */
    className: PropTypes.string,
    /** Hook for automated JavaScript tests */
    testSection: PropTypes.string,
};

DiscloseTable.Row = DiscloseRow;

export default DiscloseTable;
