/**
* External dependencies
*/
import {
Button,
__experimentalItem as Item,
__experimentalItemGroup as ItemGroup,
Card,
CardBody,
CardHeader,
CardFooter,
Spinner,
} from '@wordpress/components';
import { useState } from 'react';
/**
* Internal dependencies
*/
import { useManifests } from '../data/useManifests';
import { isURL } from '../util/url';
export const ManifestList = () => {
const { manifests, isLoading, error, createManifest, deleteManifest } =
useManifests();
const [ newManifest, setNewManifest ] = useState< string >( '' );
if ( isLoading ) {
return (
Manifests
);
}
if ( error ) {
return (
Manifests
{ error }
);
}
return (
Manifests
{ ! manifests.length && ! isLoading && (
No manifests found.
) }
{ manifests.map( ( [ manifestUrl ] ) => (
-
{ manifestUrl }
) ) }
setNewManifest( e.target.value ) }
/>
{ !! newManifest.length && ! isURL( newManifest ) && (
Invalid URL
) }
);
};