1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-24 22:35:49 -04:00

Convert Page components to TypeScript

(cherry picked from commit f35a27449d253260ba9c9fae28909cec8a87b4fe)
This commit is contained in:
Mark McDowall
2024-12-16 06:51:45 -08:00
committed by Bogdan
parent 7fdaf41325
commit 937557e214
68 changed files with 2391 additions and 2713 deletions
@@ -0,0 +1,36 @@
import React from 'react';
import Alert from 'Components/Alert';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import { kinds } from 'Helpers/Props';
interface PageSectionContentProps {
isFetching: boolean;
isPopulated: boolean;
error?: object;
errorMessage: string;
children: React.ReactNode;
}
function PageSectionContent({
isFetching,
isPopulated,
error,
errorMessage,
children,
}: PageSectionContentProps) {
if (isFetching) {
return <LoadingIndicator />;
}
if (!isFetching && !!error) {
return <Alert kind={kinds.DANGER}>{errorMessage}</Alert>;
}
if (isPopulated && !error) {
return <div>{children}</div>;
}
return null;
}
export default PageSectionContent;