conditionally render subheader

This commit is contained in:
Alex Holliday committed 2025-02-26 13:38:25 -08:00
1 parent 585ad9ae6c
commit 789c6d7a4a
2 files changed
+9

No files matched your search

+8
View File
@@ -8,6 +8,7 @@ import { Stack, Typography } from "@mui/material";
* @component
* @example
*
* @param {boolean} props.shouldRender - Whether to render the subheader
* @param {string} props.direction - Direction of the subheader
* @param {string} props.headerText - Header text
* @param {number} props.headerLevel - Font characteristic of the header
@@ -19,6 +20,7 @@ import { Stack, Typography } from "@mui/material";
*/
const SubHeader = ({
shouldRender = true,
direction = "row",
headerText,
headerLevel = 1,
@@ -29,6 +31,11 @@ const SubHeader = ({
...props
}) => {
const theme = useTheme();
if (!shouldRender) {
return null;
}
return (
<Stack
direction={direction}
@@ -63,6 +70,7 @@ const SubHeader = ({
};
SubHeader.propTypes = {
shouldRender: PropTypes.bool,
direction: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
headerText: PropTypes.string,
headerLevel: PropTypes.number,
@@ -246,6 +246,7 @@ const DistributedUptimeStatus = () => {
/>
<SubHeader
shouldRender={statusPage?.subMonitors?.length > 0}
direction={{ s: "column", md: "row" }}
headerText={t("distributedStatusServerMonitors")}
subHeaderText={t("distributedStatusServerMonitorsDescription")}