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" }, + * ]; + * + * setToInvite((prev) => ({ @@ -384,46 +384,11 @@ const TeamPanel = () => { role: [event.target.value], })) } - displayEmpty - MenuProps={{ - PaperProps: { - style: { - marginTop: theme.gap.xs, - }, - }, - MenuListProps: { - style: { padding: 0 }, - }, - }} - IconComponent={KeyboardArrowDownIcon} - sx={{ mt: theme.gap.xs }} - > - - Select role - - - Admin - - - User - - + items={[ + { _id: "admin", name: "admin" }, + { _id: "user", name: "user" }, + ]} + /> { const theme = useTheme(); @@ -118,16 +113,13 @@ const Incidents = () => { > Incident history for: - + handleChange(event, "interval")} - > - {frequencies.map((freq) => ( - - {freq} {freq === 1 ? "minute" : "minutes"} - - ))} - - + - handleChange(event, "interval", setAdvancedSettings) - } - MenuProps={{ - PaperProps: { - style: { - marginTop: "10px", - }, - }, - }} - > - {frequencies.map((freq) => ( - - {freq} {freq === 1 ? "minute" : "minutes"} - - ))} - - +