Skip to content

Commit

Permalink
update TextField
Browse files Browse the repository at this point in the history
  • Loading branch information
lerte committed Nov 5, 2024
1 parent 03e1ebd commit dc23bb1
Showing 1 changed file with 40 additions and 42 deletions.
82 changes: 40 additions & 42 deletions packages/actify/src/components/TextFields/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,49 +56,47 @@ const TextField = (props: TextFieldProps) => {
}

return (
<div>
<div className={styles[variant]}>
<Tag
{...{
label,
leadingIcon,
trailingIcon,
focused: isFocused,
count: inputProps.value?.toString().length,
populated: inputProps.value ? true : false
}}
>
{prefixText && <span className={styles['prefix']}>{prefixText}</span>}
{type == 'textarea' ? (
<textarea
{...mergeProps(focusProps, inputProps as TextFieldAria)}
ref={ref}
/>
) : (
<input
{...mergeProps(focusProps, inputProps as TextFieldAria)}
style={{
overflowX: 'hidden',
textAlign: 'inherit',
caretColor: 'var(--_caret-color)'
}}
ref={ref}
/>
)}
{suffixText && <span className={styles['suffix']}>{suffixText}</span>}
</Tag>
{props.description && (
<div {...descriptionProps} style={{ fontSize: 12 }}>
{props.description}
</div>
<label className={styles[variant]}>
<Tag
{...{
label,
leadingIcon,
trailingIcon,
focused: isFocused,
count: inputProps.value?.toString().length,
populated: inputProps.value ? true : false
}}
>
{prefixText && <span className={styles['prefix']}>{prefixText}</span>}
{type == 'textarea' ? (
<textarea
ref={ref}
{...mergeProps(focusProps, inputProps as TextFieldAria)}
/>
) : (
<input
ref={ref}
style={{
overflowX: 'hidden',
textAlign: 'inherit',
caretColor: 'var(--_caret-color)'
}}
{...mergeProps(focusProps, inputProps as TextFieldAria)}
/>
)}
{isInvalid && (
<div {...errorMessageProps} style={{ color: 'red', fontSize: 12 }}>
{validationErrors.join(' ')}
</div>
)}
</div>
</div>
{suffixText && <span className={styles['suffix']}>{suffixText}</span>}
</Tag>
{props.description && (
<div {...descriptionProps} style={{ fontSize: 12 }}>
{props.description}
</div>
)}
{isInvalid && (
<div {...errorMessageProps} style={{ color: 'red', fontSize: 12 }}>
{validationErrors.join(' ')}
</div>
)}
</label>
)
}

Expand Down

0 comments on commit dc23bb1

Please sign in to comment.