Files
Checkmate/client/src/Components/Heading/index.jsx
T

32 lines
926 B
React
Raw Normal View History

import { Typography } from "@mui/material";
import PropTypes from "prop-types";
/**
* A heading component that renders text with a specific heading level.
*
* @param {Object} props - The properties passed to the Heading component.
* @param {('h1'|'h2'|'h3')} props.component - The heading level for the component.
2025-01-12 12:28:13 -05:00
* @param {Object} props.style - Custom styles to apply to the heading.
* @param {string} props.children - The content to display inside the heading.
* @returns {JSX.Element} The Typography component with specified heading properties.
*/
2025-01-12 12:28:13 -05:00
function Heading({ component, style, children }) {
return (
<Typography
component={component}
variant="h2"
fontWeight={600}
2025-01-12 12:28:13 -05:00
style={style}
>
{children}
</Typography>
);
}
Heading.propTypes = {
component: PropTypes.oneOf(["h1", "h2", "h3"]).isRequired,
2025-01-12 12:28:13 -05:00
style: PropTypes.object,
children: PropTypes.string.isRequired,
};
export { Heading };