File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,13 @@ function SearchBarV2 ({
1414 dataAttrName = '' ,
1515 dataAttrValue = '' ,
1616 inputTextClassName = '' ,
17- paddingClass = ''
17+ paddingClass = '' ,
18+ disabled = false
1819} ) {
1920 const inputRef = useRef ( )
2021 const baseClassName = `${ styles . container } ${ paddingClass || styles . defaultPaddingClass } ` + commonStyles [ `background-color-${ backgroundColor } ` ]
2122 const [ wrapperClassName , setWrapperClassName ] = useState ( normalClassName ( ) )
22- const inputClassName = `${ styles . input } ${ inputTextClassName } `
23+ const inputClassName = `${ styles . input } ${ inputTextClassName } ${ disabled ? styles . disabled : '' } `
2324 const [ isOnFocus , setIsOnFocus ] = useState ( false )
2425 const [ showClear , setShowClear ] = useState ( false )
2526 const dataProps = { }
@@ -70,7 +71,16 @@ function SearchBarV2 ({
7071 return (
7172 < div className = { wrapperClassName } { ...dataProps } >
7273 < 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+ />
7484 { showClear && (
7585 < div className = { styles . clearContainer } >
7686 < PlatformaticIcon iconName = 'CircleCloseIcon' color = { color } size = { SMALL } onClick = { handleClear } />
Original file line number Diff line number Diff line change 2828 @apply px-2 py-1.5 md:px-3 md:py-[8.5px ];
2929}
3030
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) => {
1111 )
1212}
1313export const Standard = Template . bind ( { } )
14-
1514Standard . args = {
1615 onChange : ( value ) => {
1716 console . log ( 'Current search: ' + value )
@@ -20,3 +19,9 @@ Standard.args = {
2019 alert ( 'Query value: ' + value )
2120 }
2221}
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