import {Grid, List, Pagination} from '@mui/material';
import * as React from 'react';
import Page from "./Page";

interface List {
    id: string;
    date: string;
}

export default function Pages({pages, url, removeUrl, csrf, passphrase, setPassphrase}) {
    const isPassphraseSet = passphrase !== null;

    let listPages = pages.map(page =>
        <Page page={page} url={url} setPassphrase={setPassphrase} passphrase={passphrase} csrf={csrf} removeUrl={removeUrl} key={page.id}/>
    )

    if (isPassphraseSet) {
        return (
            <div>
                <Grid container rowSpacing={1} columnSpacing={1}>
                    {listPages}
                </Grid>
                <Pagination count={10} color="primary" />
            </div>
        );
    }

    return (<div></div>);
}
