import React from "react";
import Box from "@mui/material/Box";

import Typography from "@mui/material/Typography";

const PageTitle = ({title = "", image = ""}) => {

  return (
    <Box
      sx={{
        position: "relative",
        minHeight: "300px",
        backgroundImage: `url("${image}")`,
        backgroundSize: "cover",
        backgroundPosition: "top center",
        color: "white",
        textAlign: "center",
        overflow: "hidden", // Ensures the dim layer stays inside the box
        display:"flex"
      }}
    >
      {/* Overlay */}
      <Box
        sx={{
          position: "absolute",
          top: 0,
          left: 0,
          right: 0,
          bottom: 0,
          backgroundColor: "rgba(0, 0, 0, 0.5)", // Adjust opacity to control dimness
          zIndex: 1,
        }}
      />
      
      {/* Title */}
      <Typography
        variant="h3"
        sx={{
          position: "relative",
          zIndex: 2,
          margin:"auto auto"
        }}
      >
        {title.toUpperCase() || " "}
      </Typography>
    </Box>
  );
};

export default PageTitle;