Replaced textfield components in new monitor page
This commit is contained in:
1 parent
3adb73fe96
commit
20f04ab63e
4 files changed
+41
-20
No files matched your search
@@ -15,31 +15,36 @@
|
|||||||
.field h3.MuiTypography-root {
|
.field h3.MuiTypography-root {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
.field h3.MuiTypography-root span {
|
.field h3.MuiTypography-root span.field-required {
|
||||||
color: var(--env-var-color-19);
|
color: var(--env-var-color-19);
|
||||||
margin-left: 1px;
|
margin-left: 1px;
|
||||||
}
|
}
|
||||||
|
.field h3.MuiTypography-root span.field-optional {
|
||||||
|
opacity: 0.6;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
.field h5.MuiTypography-root {
|
.field h5.MuiTypography-root {
|
||||||
position: relative;
|
position: relative;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
padding: var(--env-var-spacing-1-minus);
|
padding-right: var(--env-var-spacing-1-minus);
|
||||||
padding-left: 0;
|
|
||||||
border-right: solid 1px var(--env-var-color-29);
|
|
||||||
}
|
}
|
||||||
.field .MuiInputBase-root {
|
.field .MuiInputBase-root {
|
||||||
height: 35px;
|
height: 34px;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
.field .MuiInputBase-root:has(.MuiInputAdornment-root) {
|
.field .MuiInputBase-root:has(.MuiInputAdornment-root) {
|
||||||
padding-right: var(--env-var-spacing-1-minus);
|
padding-right: var(--env-var-spacing-1-minus);
|
||||||
}
|
}
|
||||||
.field input {
|
.field input {
|
||||||
|
height: 100%;
|
||||||
padding: 0 var(--env-var-spacing-1-minus);
|
padding: 0 var(--env-var-spacing-1-minus);
|
||||||
}
|
}
|
||||||
.field .MuiOutlinedInput-root fieldset {
|
.field .MuiOutlinedInput-root fieldset {
|
||||||
border-color: var(--env-var-color-29);
|
border-color: var(--env-var-color-29);
|
||||||
border-radius: var(--env-var-radius-1);
|
border-radius: var(--env-var-radius-1);
|
||||||
}
|
}
|
||||||
|
.field .MuiOutlinedInput-root:hover:not(:has(input:focus)) fieldset {
|
||||||
|
border-color: var(--env-var-color-29);
|
||||||
|
}
|
||||||
.field .input-error {
|
.field .input-error {
|
||||||
color: var(--env-var-color-24);
|
color: var(--env-var-color-24);
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const Field = ({
|
|||||||
id,
|
id,
|
||||||
label,
|
label,
|
||||||
isRequired,
|
isRequired,
|
||||||
|
isOptional,
|
||||||
isVisible,
|
isVisible,
|
||||||
setVisibility,
|
setVisibility,
|
||||||
autoComplete,
|
autoComplete,
|
||||||
@@ -31,7 +32,8 @@ const Field = ({
|
|||||||
{label && (
|
{label && (
|
||||||
<Typography component="h3">
|
<Typography component="h3">
|
||||||
{label}
|
{label}
|
||||||
{isRequired ? <span>*</span> : ""}
|
{isRequired ? <span className="field-required">*</span> : ""}
|
||||||
|
{isOptional ? <span className="field-optional">(optional)</span> : ""}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
<TextField
|
<TextField
|
||||||
@@ -44,7 +46,16 @@ const Field = ({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
startAdornment: type === "url" && (
|
startAdornment: type === "url" && (
|
||||||
<Typography component="h5">https://</Typography>
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
height="100%"
|
||||||
|
sx={{
|
||||||
|
borderRight: `solid 1px ${theme.palette.section.borderColor}`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography component="h5">https://</Typography>
|
||||||
|
</Stack>
|
||||||
),
|
),
|
||||||
endAdornment: type === "password" && (
|
endAdornment: type === "password" && (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
|
|||||||
@@ -55,6 +55,13 @@
|
|||||||
outline: none;
|
outline: none;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
.create-monitor-form .MuiStack-root:has(span.MuiTypography-root.input-error) {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.create-monitor-form span.MuiTypography-root.input-error {
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.monitors-gaps-medium {
|
.monitors-gaps-medium {
|
||||||
height: var(--env-var-spacing-2);
|
height: var(--env-var-spacing-2);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
import ConfigBox from "../../Components/ConfigBox";
|
import ConfigBox from "../../Components/ConfigBox";
|
||||||
import FlexibileTextField from "../../Components/TextFields/Flexibile/FlexibileTextField";
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import RadioButton from "../../Components/RadioButton";
|
import RadioButton from "../../Components/RadioButton";
|
||||||
import CustomizableCheckBox from "../../Components/Checkbox/CustomizableCheckbox";
|
import CustomizableCheckBox from "../../Components/Checkbox/CustomizableCheckbox";
|
||||||
@@ -12,6 +11,7 @@ import { createMonitor } from "../../Features/Monitors/monitorsSlice";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import WestRoundedIcon from "@mui/icons-material/WestRounded";
|
import WestRoundedIcon from "@mui/icons-material/WestRounded";
|
||||||
|
import Field from "../../Components/TextFields/Field";
|
||||||
|
|
||||||
const CreateNewMonitor = () => {
|
const CreateNewMonitor = () => {
|
||||||
const MS_PER_MINUTE = 60000;
|
const MS_PER_MINUTE = 60000;
|
||||||
@@ -86,6 +86,7 @@ const CreateNewMonitor = () => {
|
|||||||
//obj to submit
|
//obj to submit
|
||||||
let monitor = {
|
let monitor = {
|
||||||
...generalSettings,
|
...generalSettings,
|
||||||
|
url: "https://" + generalSettings.url,
|
||||||
...checks,
|
...checks,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -162,25 +163,22 @@ const CreateNewMonitor = () => {
|
|||||||
}
|
}
|
||||||
rightLayout={
|
rightLayout={
|
||||||
<Stack gap={theme.gap.xl}>
|
<Stack gap={theme.gap.xl}>
|
||||||
<FlexibileTextField
|
<Field
|
||||||
id="monitor-url"
|
|
||||||
title="URL to monitor"
|
|
||||||
type="url"
|
type="url"
|
||||||
placeholder="https://google.com"
|
id="monitor-url"
|
||||||
|
label="URL to monitor"
|
||||||
|
placeholder="google.com"
|
||||||
value={generalSettings.url}
|
value={generalSettings.url}
|
||||||
onChange={(event) =>
|
onChange={(event) =>
|
||||||
handleChange(event, "url", setGeneralSettings)
|
handleChange(event, "url", setGeneralSettings)
|
||||||
}
|
}
|
||||||
error={errors["url"]}
|
error={errors["url"]}
|
||||||
/>
|
/>
|
||||||
<FlexibileTextField
|
<Field
|
||||||
id="monitor-name"
|
|
||||||
title={
|
|
||||||
<>
|
|
||||||
Friendly name <span>(optional)</span>
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
type="text"
|
type="text"
|
||||||
|
id="monitor-name"
|
||||||
|
label="Friendly name"
|
||||||
|
isOptional={true}
|
||||||
placeholder="Google"
|
placeholder="Google"
|
||||||
value={generalSettings.name}
|
value={generalSettings.name}
|
||||||
onChange={(event) =>
|
onChange={(event) =>
|
||||||
|
|||||||
Reference in new issue
Block a user