File tree 3 files changed +22
-4
lines changed
3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,13 @@ function SearchBarV2 ({
14
14
dataAttrName = '' ,
15
15
dataAttrValue = '' ,
16
16
inputTextClassName = '' ,
17
- paddingClass = ''
17
+ paddingClass = '' ,
18
+ disabled = false
18
19
} ) {
19
20
const inputRef = useRef ( )
20
21
const baseClassName = `${ styles . container } ${ paddingClass || styles . defaultPaddingClass } ` + commonStyles [ `background-color-${ backgroundColor } ` ]
21
22
const [ wrapperClassName , setWrapperClassName ] = useState ( normalClassName ( ) )
22
- const inputClassName = `${ styles . input } ${ inputTextClassName } `
23
+ const inputClassName = `${ styles . input } ${ inputTextClassName } ${ disabled ? styles . disabled : '' } `
23
24
const [ isOnFocus , setIsOnFocus ] = useState ( false )
24
25
const [ showClear , setShowClear ] = useState ( false )
25
26
const dataProps = { }
@@ -70,7 +71,16 @@ function SearchBarV2 ({
70
71
return (
71
72
< div className = { wrapperClassName } { ...dataProps } >
72
73
< PlatformaticIcon iconName = 'LensIcon' color = { color } disabled = { ! isOnFocus } size = { SMALL } onClick = { handleSearch } />
73
- < input type = 'text' placeholder = { placeholder } className = { inputClassName } ref = { inputRef } onChange = { handleChange } onFocus = { onFocus } onBlur = { onBlur } />
74
+ < input
75
+ type = 'text'
76
+ placeholder = { placeholder }
77
+ className = { inputClassName }
78
+ ref = { inputRef }
79
+ onChange = { handleChange }
80
+ onFocus = { onFocus }
81
+ onBlur = { onBlur }
82
+ disabled = { disabled }
83
+ />
74
84
{ showClear && (
75
85
< div className = { styles . clearContainer } >
76
86
< PlatformaticIcon iconName = 'CircleCloseIcon' color = { color } size = { SMALL } onClick = { handleClear } />
Original file line number Diff line number Diff line change 28
28
@apply px-2 py-1.5 md:px-3 md:py-[8.5px ];
29
29
}
30
30
31
+ .disabled ::placeholder {
32
+ @apply text-white/30;
33
+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ const Template = (args) => {
11
11
)
12
12
}
13
13
export const Standard = Template . bind ( { } )
14
-
15
14
Standard . args = {
16
15
onChange : ( value ) => {
17
16
console . log ( 'Current search: ' + value )
@@ -20,3 +19,9 @@ Standard.args = {
20
19
alert ( 'Query value: ' + value )
21
20
}
22
21
}
22
+
23
+ export const Disabled = Template . bind ( { } )
24
+ Disabled . args = {
25
+ disabled : true ,
26
+ placeholder : 'Disabled'
27
+ }
You can’t perform that action at this time.
0 commit comments