Skip to content

Commit

Permalink
webui: Make user name input entry shorter
Browse files Browse the repository at this point in the history
So that it indicates that the length of the name is limited to the user.
  • Loading branch information
rvykydal committed Nov 23, 2023
1 parent fa5a24f commit d96a7ec
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/components/users/Accounts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {
FormGroup,
FormHelperText,
HelperText,
HelperTextItem,
InputGroup,
TextInput,
Title,
} from "@patternfly/react-core";
Expand Down Expand Up @@ -146,6 +148,8 @@ const CreateAccount = ({
setAccounts(ac => ({ ...ac, fullName, userAccount, password, confirmPassword }));
}, [setAccounts, fullName, userAccount, password, confirmPassword]);

const userAccountValidated = isUserAccountValid === null ? "default" : isUserAccountValid ? "success" : "error";

return (
<Form
isHorizontal
Expand All @@ -172,17 +176,22 @@ const CreateAccount = ({
label={_("User account")}
fieldId={idPrefix + "-user-account"}
>
<TextInput
id={idPrefix + "-user-account"}
value={_userAccount}
onChange={(_event, val) => _setUserAccount(val)}
validated={isUserAccountValid === null ? "default" : isUserAccountValid ? "success" : "error"}
/>
<InputGroup id={idPrefix + "-user-account-input-group"}>
<TextInput
id={idPrefix + "-user-account"}
value={_userAccount}
onChange={(_event, val) => _setUserAccount(val)}
validated={userAccountValidated}
/>
</InputGroup>
{userAccountValidated === "error" &&
<FormHelperText>
<HelperText component="ul" aria-live="polite" id={idPrefix + "-full-name-helper"}>
{userAccountInvalidHint}
<HelperText>
<HelperTextItem variant={userAccountValidated}>
{userAccountInvalidHint}
</HelperTextItem>
</HelperText>
</FormHelperText>
</FormHelperText>}
</FormGroup>
{passphraseForm}
</Form>
Expand Down
4 changes: 4 additions & 0 deletions src/components/users/Accounts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
flex-direction: column;
align-items: flex-start;
}

#accounts-create-account-user-account-input-group {
width: min(39ch, 100%);
}

0 comments on commit d96a7ec

Please sign in to comment.