import { Card, Paper, TableContainer } from "@mui/material";
import { LaravelPaginatedData } from "@/@types/paginated-data";
import BasePagination from "./BasePagination";

type LaravelTableProps = {
    isLoading: boolean;
    lastRequest: number;
    data: LaravelPaginatedData;
    handlePageChange: void;
    TableContent: any;
};

function LaravelTable(props: LaravelTableProps) {
    return (
    <Card>
        <TableContainer component={Paper}>
          { props.TableContent }
        </TableContainer>

        { !props.isLoading ? 
            (<BasePagination paginationData={props.data} onPageChange={props.handlePageChange}/>) : 
            (<div></div>)
        }
    </Card>
    )
}

export default LaravelTable