integate TextInput into PasswordPanel
This commit is contained in:
1 parent
817bbb1804
commit
efd0d681ba
1 file changed
+18
-8
@@ -3,7 +3,8 @@ import { useState } from "react";
|
|||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { Box, Stack, Typography } from "@mui/material";
|
import { Box, Stack, Typography } from "@mui/material";
|
||||||
import LoadingButton from "@mui/lab/LoadingButton";
|
import LoadingButton from "@mui/lab/LoadingButton";
|
||||||
import Field from "../../Inputs/Field";
|
import { PasswordEndAdornment } from "../../Inputs/TextInput/Adornments";
|
||||||
|
import TextInput from "../../Inputs/TextInput";
|
||||||
import { credentials } from "../../../Validation/validation";
|
import { credentials } from "../../../Validation/validation";
|
||||||
import Alert from "../../Alert";
|
import Alert from "../../Alert";
|
||||||
import { update } from "../../../Features/Auth/authSlice";
|
import { update } from "../../../Features/Auth/authSlice";
|
||||||
@@ -113,7 +114,7 @@ const PasswordPanel = () => {
|
|||||||
maxWidth={"80ch"}
|
maxWidth={"80ch"}
|
||||||
marginInline={"auto"}
|
marginInline={"auto"}
|
||||||
>
|
>
|
||||||
<Field
|
<TextInput
|
||||||
type="text"
|
type="text"
|
||||||
id="hidden-username"
|
id="hidden-username"
|
||||||
name="username"
|
name="username"
|
||||||
@@ -135,14 +136,17 @@ const PasswordPanel = () => {
|
|||||||
>
|
>
|
||||||
Current password
|
Current password
|
||||||
</Typography>
|
</Typography>
|
||||||
<Field
|
<TextInput
|
||||||
type="password"
|
type="password"
|
||||||
id="edit-current-password"
|
id="edit-current-password"
|
||||||
placeholder="Enter your current password"
|
placeholder="Enter your current password"
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
value={localData.password}
|
value={localData.password}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={errors[idToName["edit-current-password"]]}
|
error={errors[idToName["edit-current-password"]] ? true : false}
|
||||||
|
helperText={errors[idToName["edit-current-password"]]}
|
||||||
|
endAdornment={<PasswordEndAdornment />}
|
||||||
|
flex={1}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack
|
<Stack
|
||||||
@@ -158,14 +162,17 @@ const PasswordPanel = () => {
|
|||||||
New password
|
New password
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Field
|
<TextInput
|
||||||
type="password"
|
type="password"
|
||||||
id="edit-new-password"
|
id="edit-new-password"
|
||||||
placeholder="Enter your new password"
|
placeholder="Enter your new password"
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
value={localData.newPassword}
|
value={localData.newPassword}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={errors[idToName["edit-new-password"]]}
|
error={errors[idToName["edit-new-password"]] ? true : false}
|
||||||
|
helperText={errors[idToName["edit-new-password"]]}
|
||||||
|
endAdornment={<PasswordEndAdornment />}
|
||||||
|
flex={1}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack
|
<Stack
|
||||||
@@ -181,14 +188,17 @@ const PasswordPanel = () => {
|
|||||||
Confirm new password
|
Confirm new password
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Field
|
<TextInput
|
||||||
type="password"
|
type="password"
|
||||||
id="edit-confirm-password"
|
id="edit-confirm-password"
|
||||||
placeholder="Reenter your new password"
|
placeholder="Reenter your new password"
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
value={localData.confirm}
|
value={localData.confirm}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={errors[idToName["edit-confirm-password"]]}
|
error={errors[idToName["edit-confirm-password"]] ? true : false}
|
||||||
|
helperText={errors[idToName["edit-confirm-password"]]}
|
||||||
|
endAdornment={<PasswordEndAdornment />}
|
||||||
|
flex={1}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
{Object.keys(errors).length > 0 && (
|
{Object.keys(errors).length > 0 && (
|
||||||
|
|||||||
Reference in new issue
Block a user