integrate TextInput into profile panel

This commit is contained in:
Alex Holliday committed 2024-11-26 13:37:35 +08:00
1 parent 2bfefcb080
commit 9e3a2bb03a
1 file changed
+11 -7
@@ -3,7 +3,7 @@ import { useRef, useState } from "react";
import TabPanel from "@mui/lab/TabPanel"; import TabPanel from "@mui/lab/TabPanel";
import { Box, Button, Divider, Stack, Typography } from "@mui/material"; import { Box, Button, Divider, Stack, Typography } from "@mui/material";
import Avatar from "../../Avatar"; import Avatar from "../../Avatar";
import Field from "../../Inputs/Field"; import TextInput from "../../Inputs/TextInput";
import ImageField from "../../Inputs/Image"; import ImageField from "../../Inputs/Image";
import { credentials, imageValidation } from "../../../Validation/validation"; import { credentials, imageValidation } from "../../../Validation/validation";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
@@ -229,26 +229,30 @@ const ProfilePanel = () => {
<Box flex={0.9}> <Box flex={0.9}>
<Typography component="h1">First name</Typography> <Typography component="h1">First name</Typography>
</Box> </Box>
<Field <TextInput
id="edit-first-name" id="edit-first-name"
value={localData.firstName} value={localData.firstName}
placeholder="Enter your first name" placeholder="Enter your first name"
autoComplete="given-name" autoComplete="given-name"
onChange={handleChange} onChange={handleChange}
error={errors[idToName["edit-first-name"]]} error={errors[idToName["edit-first-name"]] ? true : false}
helperText={errors[idToName["edit-first-name"]]}
flex={1}
/> />
</Stack> </Stack>
<Stack direction="row"> <Stack direction="row">
<Box flex={0.9}> <Box flex={0.9}>
<Typography component="h1">Last name</Typography> <Typography component="h1">Last name</Typography>
</Box> </Box>
<Field <TextInput
id="edit-last-name" id="edit-last-name"
placeholder="Enter your last name" placeholder="Enter your last name"
autoComplete="family-name" autoComplete="family-name"
value={localData.lastName} value={localData.lastName}
onChange={handleChange} onChange={handleChange}
error={errors[idToName["edit-last-name"]]} error={errors[idToName["edit-last-name"]] ? true : false}
helperText={errors[idToName["edit-last-name"]]}
flex={1}
/> />
</Stack> </Stack>
<Stack direction="row"> <Stack direction="row">
@@ -261,14 +265,14 @@ const ProfilePanel = () => {
This is your current email address — it cannot be changed. This is your current email address — it cannot be changed.
</Typography> </Typography>
</Stack> </Stack>
<Field <TextInput
id="edit-email" id="edit-email"
value={user.email} value={user.email}
placeholder="Enter your email" placeholder="Enter your email"
autoComplete="email" autoComplete="email"
onChange={() => logger.warn("disabled")} onChange={() => logger.warn("disabled")}
// error={errors[idToName["edit-email"]]}
disabled={true} disabled={true}
flex={1}
/> />
</Stack> </Stack>
<Stack direction="row"> <Stack direction="row">