import {BlacklistItem} from "~/classes/blacklistItem";
import {Button, CircularProgress} from "@mui/material";

export default function ItemList({ isFetching, blacklistItems, showDialog }: { isFetching: boolean, blacklistItems: BlacklistItem[], showDialog: Function }) {
    if (isFetching){
        return(
            <div className="loader">
                <CircularProgress aria-label="Loading…" />
            </div>
        )
    } else {
        return (
            <div className="list-container">
                <div className="item-list">
                    {blacklistItems.map((item) => {
                        return <Button onClick={() => showDialog(item)} variant="text">{item.link}</Button>
                    })}
                </div>
            </div>
        )
    }
}