Skip to content

Commit

Permalink
Adjust onChange logic for default text field
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamindehli committed May 1, 2024
1 parent 7b13e07 commit 45ae96e
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/components/Template/DefaultTextField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export function DefaultTextField({
helperText,
inputProps,
autoFocus,
required
required,
onChange
}) {
const [showHelperText, setShowHelperText] = useState(false);

Expand All @@ -44,24 +45,27 @@ export function DefaultTextField({
id={idWithFallback}
type={type}
name={name}
defaultValue={defaultValue}
defaultValue={defaultValue(name)}
inputProps={{ ...inputProps, "aria-label": labelWithFallback }}
aria-describedby={helperTextId}
autoFocus={autoFocus}
required={required}
onChange={onChange}
label={labelWithFallback}
endAdornment={
<InputAdornment position="end">
<IconButton
aria-label="toggle password visibility"
onClick={handleClickShowHelperText}
onMouseDown={handleMouseDownShowHelperText}
edge="end"
>
<Help color={showHelperText ? "primary" : "inherit"} />
</IconButton>
</InputAdornment>
helperText?.length && (
<InputAdornment position="end">
<IconButton
aria-label="toggle password visibility"
onClick={handleClickShowHelperText}
onMouseDown={handleMouseDownShowHelperText}
edge="end"
>
<Help color={showHelperText ? "primary" : "inherit"} />
</IconButton>
</InputAdornment>
)
}
label={labelWithFallback}
/>
<Collapse in={showHelperText}>
<FormHelperText id={helperTextId}>{helperText}</FormHelperText>
Expand Down

0 comments on commit 45ae96e

Please sign in to comment.