import * as React from 'react';
import Pagination from '@mui/material/Pagination';
import Stack from '@mui/material/Stack';

interface BasePaginationProps {
    page: number;
    totalCount: number;
    pageSize: number;
    onChange: (newPage: number) => void;
}

export default function BasePagination({ page, pageSize, totalCount, onChange }: BasePaginationProps) {
    return (
        <Stack spacing={2}>
            <Pagination
                page={page}
                count={Math.ceil(totalCount / pageSize)}
                onChange={(_, newPage) => onChange(newPage)}
                variant='outlined'
                shape='rounded'
                color='primary'
                sx={{
                    '.Mui-selected': {
                        backgroundColor: theme => theme.palette.primary.main,
                        color: '#fff',
                    },
                }}
            />
        </Stack>
    );
}
