import PropTypes from "prop-types"; import { useState, useEffect } from "react"; import { Box, Container, useTheme, Typography, TextField, Switch, } from "@mui/material"; import MenuIcon from "@mui/icons-material/Menu"; import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline"; import Button from "../Button/"; import AddIcon from "@mui/icons-material/Add"; /** * @component * @param {Object} props * @param { Array} props.monitors - Array of monitors associated with the section * @returns {JSX.Element} * @example * // Renders a section component with a list of monitors *
*/ const Section = ({ monitors }) => { const [monitorStates, setMonitorStates] = useState( monitors.map((monitor) => monitor.isActive) ); useEffect(() => { // Update DB here }, [monitorStates]); const handleMonitor = (monitorIndex) => { setMonitorStates((prevStates) => { const newStates = [...prevStates]; newStates[monitorIndex] = !newStates[monitorIndex]; return newStates; // Need to update DB with new monitor state }); }; const theme = useTheme(); return ( <> Section Name Servers List