11'use client' ;
22
33import React , { FC , useState } from 'react' ;
4- import { EyeIcon , EyeSlashIcon } from '@heroicons/react/24/outline' ;
4+ import {
5+ EyeIcon ,
6+ EyeSlashIcon ,
7+ MagnifyingGlassIcon ,
8+ } from '@heroicons/react/24/outline' ;
59import {
610 FormControl ,
711 IconButton ,
@@ -28,6 +32,7 @@ interface InputProps extends InputPropsMUI {
2832 password ?: boolean ;
2933 sx ?: SxProps < Theme > ;
3034 fullWidth ?: boolean ;
35+ isSearch ?: boolean ;
3136}
3237
3338const Input : FC < InputProps > = ( {
@@ -39,6 +44,7 @@ const Input: FC<InputProps> = ({
3944 password = false ,
4045 sx = { } ,
4146 fullWidth = false ,
47+ isSearch = false ,
4248 ...props
4349} ) => {
4450 const [ showPassword , setShowPassword ] = useState ( ! password ) ;
@@ -47,16 +53,22 @@ const Input: FC<InputProps> = ({
4753 setShowPassword ( ( prevShowPassword ) => ! prevShowPassword ) ;
4854 } ;
4955
50- const eyeColor =
56+ const iconColor =
5157 variant === 'white' ? theme . palette . gray [ 300 ] : theme . palette . gray [ 400 ] ;
5258
59+ const startAdornment = isSearch ? (
60+ < InputAdornment position = "start" >
61+ < MagnifyingGlassIcon width = { 24 } height = { 24 } color = { iconColor } />
62+ </ InputAdornment >
63+ ) : null ;
64+
5365 const endAdornment = password ? (
5466 < InputAdornment position = "end" >
5567 < IconButton edge = "end" onClick = { handleTogglePasswordVisibility } >
5668 { showPassword ? (
57- < EyeIcon width = { 24 } height = { 24 } color = { eyeColor } />
69+ < EyeIcon width = { 24 } height = { 24 } color = { iconColor } />
5870 ) : (
59- < EyeSlashIcon width = { 24 } height = { 24 } color = { eyeColor } />
71+ < EyeSlashIcon width = { 24 } height = { 24 } color = { iconColor } />
6072 ) }
6173 </ IconButton >
6274 </ InputAdornment >
@@ -77,6 +89,7 @@ const Input: FC<InputProps> = ({
7789 </ InputLabel >
7890 ) }
7991 < InputMUI
92+ startAdornment = { startAdornment }
8093 endAdornment = { endAdornment }
8194 sx = { styles . input ( variant ) }
8295 disableUnderline
0 commit comments