diff --git a/Client/src/Components/Inputs/Select/index.css b/Client/src/Components/Inputs/Select/index.css
new file mode 100644
index 000000000..1e8e4e354
--- /dev/null
+++ b/Client/src/Components/Inputs/Select/index.css
@@ -0,0 +1,23 @@
+.select-wrapper .select-component > .MuiSelect-select {
+ padding: 0 10px;
+ height: 34px !important;
+ display: flex !important;
+ align-items: center;
+ text-transform: capitalize;
+ line-height: 1;
+}
+.select-wrapper .MuiInputBase-root:has(> .MuiSelect-select) {
+ min-width: 150px;
+}
+.select-wrapper .MuiInputBase-root:has(> .MuiSelect-select),
+.MuiMenu-List .MuiMenuItem-root,
+.select-wrapper h3.MuiTypography-root {
+ font-size: var(--env-var-font-size-medium);
+ color: var(--env-var-color-5);
+}
+.MuiInputBase-root:has(> .MuiSelect-select) fieldset {
+ border-color: var(--env-var-color-29);
+}
+.MuiInputBase-root:not(.Mui-focused):has(> .MuiSelect-select):hover fieldset {
+ border-color: var(--env-var-color-29);
+}
diff --git a/Client/src/Components/Inputs/Select/index.jsx b/Client/src/Components/Inputs/Select/index.jsx
new file mode 100644
index 000000000..99240bc2b
--- /dev/null
+++ b/Client/src/Components/Inputs/Select/index.jsx
@@ -0,0 +1,132 @@
+import PropTypes from "prop-types";
+import { useTheme } from "@emotion/react";
+import {
+ MenuItem,
+ Select as MuiSelect,
+ Stack,
+ Typography,
+} from "@mui/material";
+import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
+
+import "./index.css";
+
+/**
+ * @component
+ * @param {object} props
+ * @param {string} props.id - The ID attribute for the select element.
+ * @param {string} props.placeholder - The label of the select element.
+ * @param {string} props.placeholder - The placeholder text when no option is selected.
+ * @param {boolean} props.isHidden - Whether the placeholder should be hidden.
+ * @param {string} props.value - The currently selected value.
+ * @param {object[]} props.items - The array of items to populate in the select dropdown.
+ * @param {(string | number)} props.items._id - The unique identifier of each item.
+ * @param {string} props.items.name - The display name of each item.
+ * @param {function} props.onChange - The function to handle onChange event.
+ * @param {object} props.sx - The custom styles object for MUI Select component.
+ * @returns {JSX.Element}
+ *
+ * @example
+ * const frequencies = [
+ * { _id: 1, name: "1 minute" },
+ * { _id: 2, name: "2 minutes" },
+ * { _id: 3, name: "3 minutes" },
+ * ];
+ *
+ *
+ */
+
+const Select = ({
+ id,
+ label,
+ placeholder,
+ isHidden,
+ value,
+ items,
+ onChange,
+ sx,
+}) => {
+ const theme = useTheme();
+ const itemStyles = {
+ fontSize: "var(--env-var-font-size-medium)",
+ color: theme.palette.otherColors.bluishGray,
+ textTransform: "capitalize",
+ borderRadius: `${theme.shape.borderRadius}px`,
+ margin: theme.gap.xs,
+ };
+
+ return (
+
+ {label && {label}}
+
+ {placeholder && (
+
+ )}
+ {items.map((item) => (
+
+ ))}
+
+
+ );
+};
+
+Select.propTypes = {
+ id: PropTypes.string.isRequired,
+ label: PropTypes.string,
+ placeholder: PropTypes.string,
+ isHidden: PropTypes.bool,
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
+ items: PropTypes.arrayOf(
+ PropTypes.shape({
+ _id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
+ name: PropTypes.string.isRequired,
+ })
+ ).isRequired,
+ onChange: PropTypes.func.isRequired,
+ sx: PropTypes.object,
+};
+
+export default Select;
diff --git a/Client/src/Components/TabPanels/Account/TeamPanel.jsx b/Client/src/Components/TabPanels/Account/TeamPanel.jsx
index a2ebebd97..699624528 100644
--- a/Client/src/Components/TabPanels/Account/TeamPanel.jsx
+++ b/Client/src/Components/TabPanels/Account/TeamPanel.jsx
@@ -5,9 +5,7 @@ import {
ButtonGroup,
Divider,
IconButton,
- MenuItem,
Modal,
- Select,
Stack,
TextField,
Typography,
@@ -18,12 +16,12 @@ import { useEffect, useState } from "react";
import EditSvg from "../../../assets/icons/edit.svg?react";
import Field from "../../Inputs/Field";
import { credentials } from "../../../Validation/validation";
-import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
import axiosInstance from "../../../Utils/axiosConfig";
import { createToast } from "../../../Utils/toastUtils";
import { useSelector } from "react-redux";
import BasicTable from "../../BasicTable";
import Remove from "../../../assets/icons/trash-bin.svg?react";
+import Select from "../../Inputs/Select";
/**
* TeamPanel component manages the organization and team members,
@@ -44,7 +42,7 @@ const TeamPanel = () => {
});
const [toInvite, setToInvite] = useState({
email: "",
- role: [""],
+ role: ["0"],
});
const [tableData, setTableData] = useState({});
const [members, setMembers] = useState([]);
@@ -202,7 +200,7 @@ const TeamPanel = () => {
};
const closeInviteModal = () => {
setIsOpen(false);
- setToInvite({ email: "", role: [""] });
+ setToInvite({ email: "", role: ["0"] });
setErrors({});
};
@@ -377,6 +375,8 @@ const TeamPanel = () => {
/>
+ items={[
+ { _id: "admin", name: "admin" },
+ { _id: "user", name: "user" },
+ ]}
+ />
{
const theme = useTheme();
@@ -118,16 +113,13 @@ const Incidents = () => {
>
Incident history for:
-
+
-
+
);
};
diff --git a/Client/src/Pages/Monitors/Configure/index.css b/Client/src/Pages/Monitors/Configure/index.css
index 693e9f804..3d3ed04f2 100644
--- a/Client/src/Pages/Monitors/Configure/index.css
+++ b/Client/src/Pages/Monitors/Configure/index.css
@@ -69,4 +69,9 @@
display: flex;
flex-direction: column;
gap: var(--env-var-spacing-4);
+}
+
+body:has(.configure-monitor) .select-dropdown .MuiMenuItem-root,
+.configure-monitor .select-wrapper .select-component > .MuiSelect-select {
+ text-transform: lowercase;
}
\ No newline at end of file
diff --git a/Client/src/Pages/Monitors/Configure/index.jsx b/Client/src/Pages/Monitors/Configure/index.jsx
index 8c5fa4f20..0716ad283 100644
--- a/Client/src/Pages/Monitors/Configure/index.jsx
+++ b/Client/src/Pages/Monitors/Configure/index.jsx
@@ -5,15 +5,15 @@ import { useEffect, useState } from "react";
import Button from "../../../Components/Button";
import Field from "../../../Components/Inputs/Field";
import RadioButton from "../../../Components/RadioButton";
-import { Box, MenuItem, Select, Stack, Typography } from "@mui/material";
+import { Box, MenuItem, Stack, Typography } from "@mui/material";
import WestRoundedIcon from "@mui/icons-material/WestRounded";
import GreenCheck from "../../../assets/icons/checkbox-green.svg?react";
import RedCheck from "../../../assets/icons/checkbox-red.svg?react";
import PauseCircleOutlineIcon from "@mui/icons-material/PauseCircleOutline";
-import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
import "./index.css";
import { monitorValidation } from "../../../Validation/validation";
+import Select from "../../../Components/Inputs/Select";
const formatDurationRounded = (ms) => {
const seconds = Math.floor(ms / 1000);
@@ -119,7 +119,13 @@ const Configure = () => {
// TODO
};
- const frequencies = [1, 2, 3, 4, 5];
+ const frequencies = [
+ { _id: 1, name: "1 minute" },
+ { _id: 2, name: "2 minutes" },
+ { _id: 3, name: "3 minutes" },
+ { _id: 4, name: "4 minutes" },
+ { _id: 5, name: "5 minutes" },
+ ];
return (
{
Advanced settings
-
-
- Check frequency
-
-
-
+
diff --git a/Client/src/Pages/Monitors/CreateMonitor/index.css b/Client/src/Pages/Monitors/CreateMonitor/index.css
index 59745a6cd..7454973d5 100644
--- a/Client/src/Pages/Monitors/CreateMonitor/index.css
+++ b/Client/src/Pages/Monitors/CreateMonitor/index.css
@@ -10,14 +10,12 @@
font-size: var(--env-var-font-size-large);
}
.create-monitor p.MuiTypography-root,
-.create-monitor button.MuiButtonBase-root,
-#monitor-frequencies {
+.create-monitor button.MuiButtonBase-root {
font-size: var(--env-var-font-size-medium);
}
.create-monitor h2.MuiTypography-root,
.create-monitor h6.MuiTypography-root,
-.create-monitor p.MuiTypography-root,
-#monitor-frequencies {
+.create-monitor p.MuiTypography-root {
color: var(--env-var-color-2);
}
.create-monitor h6.MuiTypography-root {
@@ -36,21 +34,6 @@
position: absolute;
top: 0;
}
-.create-monitor .MuiSelect-select.MuiSelect-outlined.MuiInputBase-input {
- padding: var(--env-var-spacing-1);
-}
-.create-monitor .MuiInputBase-root:has(#monitor-frequencies) {
- min-width: 300px;
- width: 100%;
- height: 34px;
- border: 1px solid var(--env-var-color-4);
- border-radius: var(--env-var-radius-1);
- overflow: hidden;
-}
-.create-monitor .MuiInputBase-root:has(#monitor-frequencies) fieldset {
- outline: none;
- border: none;
-}
.create-monitor .MuiStack-root:has(span.MuiTypography-root.input-error) {
position: relative;
}
@@ -75,4 +58,9 @@
display: flex;
flex-direction: column;
gap: var(--env-var-spacing-4);
+}
+
+body:has(.create-monitor) .select-dropdown .MuiMenuItem-root,
+.create-monitor .select-wrapper .select-component > .MuiSelect-select {
+ text-transform: lowercase;
}
\ No newline at end of file
diff --git a/Client/src/Pages/Monitors/CreateMonitor/index.jsx b/Client/src/Pages/Monitors/CreateMonitor/index.jsx
index 8e321e0aa..ff151bb35 100644
--- a/Client/src/Pages/Monitors/CreateMonitor/index.jsx
+++ b/Client/src/Pages/Monitors/CreateMonitor/index.jsx
@@ -2,7 +2,7 @@ import "./index.css";
import React, { useState } from "react";
import RadioButton from "../../../Components/RadioButton";
import Button from "../../../Components/Button";
-import { Box, MenuItem, Select, Stack, Typography } from "@mui/material";
+import { Box, MenuItem, Stack, Typography } from "@mui/material";
import { useSelector, useDispatch } from "react-redux";
import { monitorValidation } from "../../../Validation/validation";
import { createMonitor } from "../../../Features/Monitors/monitorsSlice";
@@ -10,6 +10,7 @@ import { useNavigate } from "react-router-dom";
import { useTheme } from "@emotion/react";
import WestRoundedIcon from "@mui/icons-material/WestRounded";
import Field from "../../../Components/Inputs/Field";
+import Select from "../../../Components/Inputs/Select";
const CreateMonitor = () => {
const MS_PER_MINUTE = 60000;
@@ -125,7 +126,13 @@ const CreateMonitor = () => {
//select values
// const ports = ["Port 1", "Port 2", "Port 3"];
- const frequencies = [1, 2, 3, 4, 5];
+ const frequencies = [
+ { _id: 1, name: "1 minute" },
+ { _id: 2, name: "2 minutes" },
+ { _id: 3, name: "3 minutes" },
+ { _id: 4, name: "4 minutes" },
+ { _id: 5, name: "5 minutes" },
+ ];
return (
{
Advanced settings
- {/* TODO - refactor select component */}
-
-
- Check frequency
-
-
-
+