import React from 'react'; import { ExclamationCircleIcon, QuestionCircleIcon } from '@patternfly/react-icons'; import { PageSection, Content, EmptyState, EmptyStateVariant, Spinner, EmptyStateBody, PageBreadcrumb, StackItem, Stack, Flex, } from '@patternfly/react-core'; type ApplicationsPageProps = { title?: React.ReactNode; breadcrumb?: React.ReactNode; description?: React.ReactNode; loaded: boolean; empty: boolean; loadError?: Error; children?: React.ReactNode; errorMessage?: string; emptyMessage?: string; emptyStatePage?: React.ReactNode; headerAction?: React.ReactNode; headerContent?: React.ReactNode; provideChildrenPadding?: boolean; removeChildrenTopPadding?: boolean; subtext?: React.ReactNode; loadingContent?: React.ReactNode; noHeader?: boolean; }; const ApplicationsPage: React.FC = ({ title, breadcrumb, description, loaded, empty, loadError, children, errorMessage, emptyMessage, emptyStatePage, headerAction, headerContent, provideChildrenPadding, removeChildrenTopPadding, subtext, loadingContent, noHeader, }) => { const renderHeader = () => ( {title} {subtext && {subtext}} {description && {description}} {headerAction} {headerContent && {headerContent}} ); const renderContents = () => { if (loadError) { return ( {loadError.message} ); } if (!loaded) { return ( loadingContent || ( ) ); } if (empty) { return !emptyStatePage ? ( ) : ( emptyStatePage ); } if (provideChildrenPadding) { return ( {children} ); } return children; }; return ( <> {breadcrumb && {breadcrumb}} {!noHeader && renderHeader()} {renderContents()} ); }; export default ApplicationsPage;