import { Select, Pagination } from "@mantine/core";

export default function PaginationControl({ totalItems, page, pageSize, onPageChange, onPageSizeChange }) {
  const totalPages = Math.ceil(totalItems / pageSize);

  return (
    <div style={{ display: "flex", justifyContent: "space-between", marginTop: 16 }}>
      <Select
        data={["5", "10", "20", "50"]}
        value={pageSize.toString()}
        onChange={(val) => onPageSizeChange(Number(val))}
        style={{ width: 100 }}
      />
      <Pagination total={totalPages} page={page} onChange={onPageChange} />
    </div>
  );
}
