Refactored password tab

This commit is contained in:
Daniel Cojocea committed 2024-08-20 19:39:55 -04:00
1 parent 0ec5e6dcde
commit 9a1934a77a
2 files changed
+33 -39

No files matched your search

@@ -98,16 +98,17 @@ const PasswordPanel = () => {
return ( return (
<TabPanel value="password"> <TabPanel value="password">
<form <Stack
component="form"
onSubmit={handleSubmit} onSubmit={handleSubmit}
className="edit-password-form"
noValidate noValidate
spellCheck="false" spellCheck="false"
gap={theme.gap.xl}
> >
<div className="edit-password-form__wrapper"> <Stack direction="row">
<Stack> <Box flex={0.9}>
<Typography component="h1">Current password</Typography> <Typography component="h1">Current password</Typography>
</Stack> </Box>
<Field <Field
type="password" type="password"
id="edit-current-password" id="edit-current-password"
@@ -117,11 +118,11 @@ const PasswordPanel = () => {
onChange={handleChange} onChange={handleChange}
error={errors[idToName["edit-current-password"]]} error={errors[idToName["edit-current-password"]]}
/> />
</div> </Stack>
<div className="edit-password-form__wrapper"> <Stack direction="row">
<Stack> <Box flex={0.9}>
<Typography component="h1">New password</Typography> <Typography component="h1">New password</Typography>
</Stack> </Box>
<Field <Field
type="password" type="password"
id="edit-new-password" id="edit-new-password"
@@ -131,11 +132,11 @@ const PasswordPanel = () => {
onChange={handleChange} onChange={handleChange}
error={errors[idToName["edit-new-password"]]} error={errors[idToName["edit-new-password"]]}
/> />
</div> </Stack>
<div className="edit-password-form__wrapper"> <Stack direction="row">
<Stack> <Box flex={0.9}>
<Typography component="h1">Confirm new password</Typography> <Typography component="h1">Confirm new password</Typography>
</Stack> </Box>
<Field <Field
type="password" type="password"
id="edit-confirm-password" id="edit-confirm-password"
@@ -145,33 +146,32 @@ const PasswordPanel = () => {
onChange={handleChange} onChange={handleChange}
error={errors[idToName["edit-confirm-password"]]} error={errors[idToName["edit-confirm-password"]]}
/> />
</div> </Stack>
<div className="edit-password-form__wrapper"> <Stack direction="row">
<Stack></Stack> <Box flex={0.9}></Box>
<Box sx={{ flex: 1 }}> <Box sx={{ flex: 1 }}>
<Alert <Alert
variant="warning" variant="warning"
body="New password must contain at least 8 characters and must have at least one uppercase letter, one number and one symbol." body="New password must contain at least 8 characters and must have at least one uppercase letter, one number and one symbol."
/> />
</Box> </Box>
</div>
<Divider aria-hidden="true" width="0" />
<Stack direction="row" justifyContent="flex-end">
<Box width="fit-content">
<ButtonSpinner
level="primary"
label="Save"
onClick={handleSubmit}
isLoading={isLoading}
loadingText="Saving..."
disabled={Object.keys(errors).length !== 0 && true}
sx={{
paddingX: theme.gap.xl,
}}
/>
</Box>
</Stack> </Stack>
</form> <Stack direction="row" justifyContent="flex-end">
<ButtonSpinner
level="primary"
label="Save"
onClick={handleSubmit}
isLoading={isLoading}
loadingText="Saving..."
disabled={Object.keys(errors).length !== 0 && true}
sx={{
paddingX: theme.gap.large,
width: "fit-content",
mt: theme.gap.xl,
}}
/>
</Stack>
</Stack>
</TabPanel> </TabPanel>
); );
}; };
-6
View File
@@ -42,17 +42,11 @@
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
} }
.edit-password-form__wrapper > .MuiStack-root:not(.row-stack) {
flex-direction: column;
gap: 8px;
margin-right: 10px;
}
#modal-delete-account, #modal-delete-account,
#modal-edit-org-name, #modal-edit-org-name,
#modal-invite-member { #modal-invite-member {
font-size: var(--env-var-font-size-large); font-size: var(--env-var-font-size-large);
} }
.edit-password-form__wrapper:not(:first-of-type),
.edit-team-form__wrapper:not(:first-of-type) { .edit-team-form__wrapper:not(:first-of-type) {
margin-top: var(--env-var-spacing-4); margin-top: var(--env-var-spacing-4);
} }