import { useState } from "react"; // components import { DeletePageModal } from "components/pages"; import { Loader } from "components/ui"; import { SinglePageGridItem } from "components/pages/page-grid-item"; // types import { IPage } from "types"; export const PagesGrid: React.FC = ({ pages, setCreateUpdatePageModal, setSelectedPage }) => { const [pageDeleteModal, setPageDeleteModal] = useState(false); const [selectedPageForDelete, setSelectedPageForDelete] = useState(); const handleDeletePage = (page: IPage) => { setSelectedPageForDelete({ ...page, actionType: "delete" }); setPageDeleteModal(true); }; const handleEditPage = (page: IPage) => { setSelectedPage({ ...page, actionType: "edit" }); setCreateUpdatePageModal(true); }; return ( <> {pages ? ( pages.length > 0 ? (
    {pages.map((page: any) => ( handleDeletePage(page)} handleEditPage={() => handleEditPage(page)} /> ))}
) : ( "No Pages found" ) ) : ( )} ); };