From 45ae96e42edf7e7453af8f3ea5217a8c97480709 Mon Sep 17 00:00:00 2001 From: Benjamin Dehli Date: Wed, 1 May 2024 19:46:18 +0200 Subject: [PATCH] Adjust onChange logic for default text field --- src/components/Template/DefaultTextField.jsx | 30 +++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/components/Template/DefaultTextField.jsx b/src/components/Template/DefaultTextField.jsx index 989e427..b12affb 100644 --- a/src/components/Template/DefaultTextField.jsx +++ b/src/components/Template/DefaultTextField.jsx @@ -23,7 +23,8 @@ export function DefaultTextField({ helperText, inputProps, autoFocus, - required + required, + onChange }) { const [showHelperText, setShowHelperText] = useState(false); @@ -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={ - - - - - + helperText?.length && ( + + + + + + ) } - label={labelWithFallback} /> {helperText}