diff --git a/Client/src/Components/TextFields/Field/index.css b/Client/src/Components/TextFields/Field/index.css new file mode 100644 index 000000000..10d4c6720 --- /dev/null +++ b/Client/src/Components/TextFields/Field/index.css @@ -0,0 +1,49 @@ +.field { + min-width: 250px; +} +.field h1.MuiTypography-root, +.field h5.MuiTypography-root, +.field input, +.field .input-error { + font-size: var(--env-var-font-size-medium); +} +.field h1.MuiTypography-root, +.field h5.MuiTypography-root, +.field input { + color: var(--env-var-color-5); +} +.field h1.MuiTypography-root { + font-weight: 600; +} +.field h1.MuiTypography-root span { + color: var(--env-var-color-19); + margin-left: 1px; +} +.field h5.MuiTypography-root { + position: relative; + opacity: 0.8; + padding: var(--env-var-spacing-1-minus); + padding-left: 0; + border-right: solid 1px var(--env-var-color-29); +} +.field .MuiInputBase-root { + height: 39px; + padding-right: var(--env-var-spacing-1-minus); +} +.field input { + padding: var(--env-var-spacing-1-minus); +} +.field .MuiOutlinedInput-root fieldset { + border-color: var(--env-var-color-29); + border-radius: var(--env-var-radius-1); +} +.field .MuiOutlinedInput-root:hover fieldset { + border-color: var(--env-var-color-25); +} +.field .input-error { + color: var(--env-var-color-24); + opacity: 0.8; +} +.field:has(.input-error) .MuiOutlinedInput-root fieldset { + border-color: #fda29b; +} diff --git a/Client/src/Components/TextFields/Field/index.jsx b/Client/src/Components/TextFields/Field/index.jsx new file mode 100644 index 000000000..811146faa --- /dev/null +++ b/Client/src/Components/TextFields/Field/index.jsx @@ -0,0 +1,93 @@ +import { useTheme } from "@emotion/react"; +import { + IconButton, + InputAdornment, + Stack, + TextField, + Typography, +} from "@mui/material"; +import VisibilityOff from "@mui/icons-material/VisibilityOff"; +import Visibility from "@mui/icons-material/Visibility"; +import "./index.css"; + +const Field = ({ + type, + id, + label, + isRequired, + isVisible, + setVisibility, + autoComplete, + placeholder, + value, + onChange, + error, + disabled, +}) => { + const theme = useTheme(); + + return ( + + {label && ( + + {label} + {isRequired ? * : ""} + + )} + http://, + } + : type === "password" && { + endAdornment: ( + + setVisibility((show) => !show)} + tabIndex={-1} + sx={{ + color: theme.palette.section.borderColor, + padding: theme.gap.xs, + "&:focus": { + outline: "none", + }, + "& .MuiTouchRipple-root": { + pointerEvents: "none", + display: "none", + }, + }} + > + {!isVisible ? : } + + + ), + } + } + /> + {error && ( + + {error} + + )} + + ); +}; + +export default Field; diff --git a/Client/src/Pages/Demo/Demo.jsx b/Client/src/Pages/Demo/Demo.jsx index 6a7a07e11..9d3cea52d 100644 --- a/Client/src/Pages/Demo/Demo.jsx +++ b/Client/src/Pages/Demo/Demo.jsx @@ -41,7 +41,7 @@ import ImageField from "../../Components/TextFields/Image"; import ProgressUpload from "../../Components/ProgressBars"; import Alert from "../../Components/Alert"; import { createToast } from "../../Utils/toastUtils"; -import { ToastContainer } from "react-toastify"; +import Field from "../../Components/TextFields/Field"; const cols = [ { @@ -203,6 +203,9 @@ const Demo = () => { setIsLoading(false); }, 4000); }; + + //fields + const [visibility, setVisibility] = useState(false); return (
@@ -439,7 +442,7 @@ const Demo = () => { /> - + { body="Since you logged in via SSO, you cannot reset or modify your password." /> - + - + - + { isToast={true} /> - + { - + + + + + + +
); }; diff --git a/Client/src/Utils/Theme.js b/Client/src/Utils/Theme.js index 4b345c9de..f3ed11fc3 100644 --- a/Client/src/Utils/Theme.js +++ b/Client/src/Utils/Theme.js @@ -91,6 +91,7 @@ const theme = createTheme({ pY: "40px", }, gap: { + xs: "4px", small: "8px", medium: "12px", ml: "16px", @@ -101,7 +102,7 @@ const theme = createTheme({ info: { color: secondaryMain, bg: otherColorsWhite, - border: "#d0d5dd", + border: sectionBorder, }, error: { color: "#d92d20", @@ -111,7 +112,7 @@ const theme = createTheme({ warning: { color: "#DC6803", bg: "#fffcf5", - border: "#fec84b" + border: "#fec84b", }, }, }); diff --git a/Client/src/index.css b/Client/src/index.css index 086692678..674acc13e 100644 --- a/Client/src/index.css +++ b/Client/src/index.css @@ -59,6 +59,7 @@ --env-var-spacing-1: 12px; --env-var-spacing-1-plus: 16px; + --env-var-spacing-1-minus: 10px; --env-var-spacing-2: 24px; --env-var-spacing-3: 32px; --env-var-spacing-4: 40px;