Update input

Make a consistent height with select triggers and fix props
This commit is contained in:
Justin Edmund 2023-06-30 12:28:36 -07:00
parent 072f6425f7
commit fd6e788c4d
2 changed files with 16 additions and 8 deletions

View file

@ -1,3 +1,7 @@
.full {
width: 100%;
}
.input {
-webkit-font-smoothing: antialiased;
background-color: var(--input-bg);
@ -11,7 +15,7 @@
padding: $unit * 1.5 $unit-2x;
}
&.wrapper {
&.accessory {
$offset: 2px;
align-items: center;
@ -25,7 +29,7 @@
color: var(--text-tertiary);
display: block;
font-weight: $bold;
line-height: 42px;
line-height: 48px;
position: absolute;
right: $unit-2x;
top: 0;
@ -36,7 +40,7 @@
border-radius: $input-corner;
border: none;
box-sizing: border-box;
padding: $unit * 1.5 $unit-2x;
padding: ($unit * 1.75) $unit-2x;
width: 100%;
}
}
@ -58,6 +62,10 @@
}
}
&.number {
min-width: $unit-8x;
}
&.AlignRight {
text-align: right;
}

View file

@ -27,12 +27,12 @@ const Input = React.forwardRef<HTMLInputElement, Props>(function input(
// Classes
const wrapperClasses = classNames(
{
[styles.wrapper]: showCounter,
[styles.wrapper]: true,
[styles.accessory]: showCounter,
[styles.input]: showCounter,
[styles.bound]: showCounter && bound,
},
showCounter &&
props.className?.split(' ').map((className) => styles[className])
props.className?.split(' ').map((className) => styles[className])
)
const inputClasses = classNames(
@ -43,7 +43,7 @@ const Input = React.forwardRef<HTMLInputElement, Props>(function input(
!showCounter &&
props.className?.split(' ').map((className) => styles[className])
)
const { defaultValue, ...inputProps } = props
const { defaultValue, hide1Password, ...inputProps } = props
// Hooks
useEffect(() => {
@ -67,7 +67,7 @@ const Input = React.forwardRef<HTMLInputElement, Props>(function input(
type={props.type}
name={props.name}
placeholder={props.placeholder}
defaultValue={value || ''}
value={value || ''}
onBlur={props.onBlur}
onChange={handleChange}
maxLength={props.maxLength}