import React from "react";

type num = {
    total: number,
    page: number, 
    setPage: Function
}

export function PaginationLeft ({total, page, setPage} : num) {
    const numPages = Math.ceil(total / 15);
// export function PaginationLeft ({ page, setPage} : num) {
//     const numPages = 3
    return (
        <div>
            <button onClick={() => setPage(page - 1)} disabled={page === 1}>
                &lt;{page}
            </button>

            {/* {Array(numPages)
                .fill(1)
                .map((_, i) => (
                    <button key={i + 1} onClick={() => setPage(i + 1)}>
                        {i + 1}
                    </button>
                ))} */}
        </div>
    );
};
export function PaginationRight ({total, page, setPage} : num) {
    const numPages = Math.ceil(total / 15);
// export function PaginationRight ({ page, setPage} : num) {
//     const numPages = 3;

    return (
        <div>
            <button onClick={() => setPage(page + 1)} disabled={page === numPages}>
                &gt;
            </button>
        </div>
    );
};
