Skip to content

Commit 1b0c086

Browse files
committed
chore: move labels to form inputs
1 parent a22c89c commit 1b0c086

File tree

4 files changed

+26
-34
lines changed

4 files changed

+26
-34
lines changed

src/components/FormV2/KeyValue.tsx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import { useEffect, useMemo, useState } from "react";
2-
import Box from "@mui/material/Box";
32
import Table from "@mui/material/Table";
43
import TableBody from "@mui/material/TableBody";
54
import TableCell from "@mui/material/TableCell";
6-
import TableHead from "@mui/material/TableHead";
75
import TableFooter from "@mui/material/TableFooter";
86
import TableRow from "@mui/material/TableRow";
97
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
108
import AddIcon from "@mui/icons-material/Add";
119
import Button from "@mui/material/Button";
1210
import TextFieldModal from "./KeyValueTextFieldModal";
1311
import KeyValueRow from "./KeyValueRow";
14-
import { grey } from "@mui/material/colors";
1512

1613
interface Props {
1714
inputName: string;
@@ -83,32 +80,17 @@ export default function KeyValue({
8380
}
8481
}, [rowsWithoutDeleted, isChanged]);
8582

86-
const borderBottom = "1px solid";
87-
const borderColor = grey[300];
88-
8983
return (
9084
<>
9185
<Table>
92-
<TableHead>
93-
<TableRow>
94-
<TableCell
95-
sx={{ borderBottom, borderColor, color: "text.secondary" }}
96-
>
97-
{keyName}
98-
</TableCell>
99-
<TableCell
100-
sx={{ borderBottom, borderColor, color: "text.secondary" }}
101-
>
102-
<Box sx={{ pl: 1.75 }}>{valName}</Box>
103-
</TableCell>
104-
</TableRow>
105-
</TableHead>
10686
<TableBody>
10787
{rows.map(([key, value, isDeleted], index) =>
10888
isDeleted ? undefined : (
10989
<KeyValueRow
11090
key={index}
11191
rows={rows}
92+
labelKey={keyName}
93+
labelValue={valName}
11294
inputKey={key}
11395
inputValue={value}
11496
inputName={inputName}

src/components/FormV2/KeyValueRow.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import Input from "./Input";
99

1010
interface KeyValueRowProps {
1111
index: number;
12+
labelKey: string;
13+
labelValue: string;
1214
inputKey: string;
1315
inputValue: string;
1416
inputName: string;
@@ -33,6 +35,8 @@ export default function KeyValueRow({
3335
keyPlaceholder,
3436
valPlaceholder,
3537
hideByDefault,
38+
labelKey,
39+
labelValue,
3640
setRows,
3741
setIsChanged,
3842
}: KeyValueRowProps) {
@@ -44,10 +48,16 @@ export default function KeyValueRow({
4448
<Input
4549
fullWidth
4650
placeholder={index === 0 ? keyPlaceholder : `KEY_${index + 1}`}
47-
inputProps={{
48-
"data-1p-ignore": "true",
49-
"aria-label": `${inputName} key number ${index + 1}`,
51+
slotProps={{
52+
htmlInput: {
53+
"data-1p-ignore": "true",
54+
"aria-label": `${inputName} key number ${index + 1}`,
55+
},
56+
inputLabel: {
57+
shrink: true,
58+
},
5059
}}
60+
label={labelKey}
5161
name={`${inputName}[key]`}
5262
onChange={e => {
5363
const copy = JSON.parse(JSON.stringify(rows));
@@ -62,13 +72,19 @@ export default function KeyValueRow({
6272
<Input
6373
fullWidth
6474
value={value}
75+
label={labelValue}
6576
autoComplete="off"
6677
type={isValueVisible ? "text" : "password"}
6778
placeholder={index === 0 ? valPlaceholder : `VALUE_${index + 1}`}
6879
name={`${inputName}[value]`}
69-
inputProps={{
70-
"data-1p-ignore": "true",
71-
"aria-label": `${inputName} value number ${index + 1}`,
80+
slotProps={{
81+
htmlInput: {
82+
"data-1p-ignore": "true",
83+
"aria-label": `${inputName} value number ${index + 1}`,
84+
},
85+
inputLabel: {
86+
shrink: true,
87+
},
7288
}}
7389
onChange={e => {
7490
const copy = JSON.parse(JSON.stringify(rows));

src/pages/admin/Proxies.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export default function Proxies() {
222222
<>
223223
Configure reverse proxies for your 3rd party applications.
224224
<br />
225-
Stormkit will issue TLS certifciates automatically for proxied these
225+
Stormkit will issue TLS certificates automatically for these proxied
226226
domains.
227227
</>
228228
}
@@ -290,9 +290,7 @@ export default function Proxies() {
290290

291291
api
292292
.put("/admin/system/proxies", {
293-
proxies: {
294-
[proxyToBeDeleted]: undefined,
295-
},
293+
remove: [proxyToBeDeleted],
296294
})
297295
.then(() => {
298296
setRefreshToken(Date.now());
@@ -306,8 +304,6 @@ export default function Proxies() {
306304
setLoading(false);
307305
setProxyToBeDeleted(undefined);
308306
});
309-
310-
return "";
311307
}}
312308
>
313309
This will delete the proxy rule. Previously configured domain may stop

src/pages/admin/System.spec.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ describe("~/pages/admin/System.tsx", () => {
4646
"Manage runtimes that are installed on your Stormkit instance."
4747
)
4848
).toBeTruthy();
49-
expect(wrapper.getByText("Runtime name")).toBeTruthy();
50-
expect(wrapper.getByText("Runtime version")).toBeTruthy();
5149
});
5250

5351
it("should submit the form", async () => {

0 commit comments

Comments
 (0)