Files
Checkmate/src/Components/Subheader/index.jsx
T

89 lines
2.3 KiB
React
Raw Normal View History

import PropTypes from "prop-types";
import { useTheme } from "@emotion/react";
import { Box, Stack, Typography } from "@mui/material";
import { RowContainer } from "../StandardContainer";
/**
*
* @component
* @example
*
* @param {string} props.headerText - Header text
* @param {number} props.headerLevel - Font characteristic of the header
* @param {string} props.subHeaderText - Subheader text
* @param {number} props.subHeaderLevel - Font characteristic of the subheader
* @param {string} props.rightCatagoryTitle - Message for right section
* @param {number} props.rightCatagoryTitleLevel - Font characteristic of the right section header
* @param {string} props.rightDescription - Description for right section
* @param {number} props.rightDescriptionLevel - Font characteristic of the right section description
* @returns {JSX.Element} The rendered component
*/
2025-02-23 17:47:02 -08:00
const SubHeader = ({
headerText,
headerLevel = 1,
subHeaderText,
subHeaderLevel = 1,
rightCatagoryTitle,
rightCatagoryTitleLevel = 2,
rightDescription,
rightDescriptionLevel = 2,
}) => {
const theme = useTheme();
2025-02-23 17:47:02 -08:00
return (
2025-02-23 17:47:02 -08:00
<Stack
direction="row"
justifyContent="space-between"
2025-02-23 17:47:02 -08:00
>
<Stack direction={"column"}>
<Typography
component={`h${headerLevel}`}
variant={`h${headerLevel}`}
mb={theme.spacing(1)}
>
<Typography
component="span"
fontSize="inherit"
color={theme.palette.primary.contrastTextTertiary}
>
{headerText}
</Typography>
</Typography>
<Typography
variant={`body${subHeaderLevel}`}
color={theme.palette.primary.contrastTextTertiary}
>
{subHeaderText}
</Typography>
</Stack>
2025-02-23 17:47:02 -08:00
{rightCatagoryTitle && (
<RowContainer sx={{ width: "20%" }}>
<Stack>
2025-02-23 17:47:02 -08:00
<Typography variant={`body${rightCatagoryTitleLevel}`}>
{rightCatagoryTitle}
</Typography>
<Typography variant={`h${rightDescriptionLevel}`}>
{rightDescription}
</Typography>
</Stack>
</RowContainer>
2025-02-23 17:47:02 -08:00
)}
</Stack>
);
};
SubHeader.propTypes = {
2025-02-23 17:47:02 -08:00
headerText: PropTypes.string,
headerLevel: PropTypes.number,
subHeaderText: PropTypes.string,
subHeaderLevel: PropTypes.number,
rightCatagoryTitle: PropTypes.string,
rightCatagoryTitleLevel: PropTypes.number,
rightDescription: PropTypes.string,
rightDescriptionLevel: PropTypes.number,
};
export default SubHeader;