Skip to content

Commit 92e5c22

Browse files
committed
[#43] ♻️ TextInput props and wrapping div structure
1 parent 1201722 commit 92e5c22

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/components/common/input/TextInput.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import clsx from 'clsx'
2-
import { ReactNode } from 'react'
32
import { FieldValues, UseFormRegister } from 'react-hook-form'
43
import { twMerge } from 'tailwind-merge'
54

65
export interface TextInputProps
76
extends React.InputHTMLAttributes<HTMLInputElement> {
87
error?: boolean
98
register?: ReturnType<UseFormRegister<FieldValues>>
10-
startAdornment?: ReactNode
11-
endAdornment?: ReactNode
9+
startAdornment?: React.ReactElement
10+
endAdornment?: React.ReactElement
1211
fullWidth?: boolean
1312
}
1413

@@ -20,8 +19,8 @@ export const TextInput = ({
2019
type = 'text',
2120
error = false,
2221
register,
23-
startAdornment = '',
24-
endAdornment = '',
22+
startAdornment,
23+
endAdornment,
2524
className = '',
2625
fullWidth = false,
2726
...props
@@ -40,7 +39,7 @@ export const TextInput = ({
4039
)
4140

4241
return (
43-
<div className='relative'>
42+
<div className={clsx('relative', fullWidth ? 'w-full' : 'w-min')}>
4443
{startAdornment && (
4544
<span className='absolute left-14 top-10'>{startAdornment}</span>
4645
)}

0 commit comments

Comments
 (0)