File tree Expand file tree Collapse file tree 3 files changed +36
-14
lines changed Expand file tree Collapse file tree 3 files changed +36
-14
lines changed Original file line number Diff line number Diff line change 1
1
import { useCallback , useMemo , useState } from 'react'
2
2
import ReactSelect , { MenuListProps } from 'react-select'
3
3
import { Option , OptionType } from '../../../Common'
4
- import { commonSelectStyles , LoadingIndicator , MenuListWithApplyButton } from '../ReactSelect'
4
+ import { LoadingIndicator , MenuListWithApplyButton } from '../ReactSelect'
5
5
import { GenericSectionErrorState } from '../GenericSectionErrorState'
6
6
import { PluginTagSelectProps } from './types'
7
- import { PluginTagSelectValueContainer } from './utils'
7
+ import { PluginTagSelectValueContainer , pluginTagSelectStyles } from './utils'
8
8
9
9
const PluginTagSelect = ( {
10
10
availableTags,
@@ -50,10 +50,9 @@ const PluginTagSelect = ({
50
50
return < MenuListWithApplyButton { ...props } handleApplyFilter = { handleApplyFilters } />
51
51
} , [ ] )
52
52
53
- // TODO: Look if should close menu on apply
54
53
return (
55
54
< ReactSelect
56
- styles = { commonSelectStyles }
55
+ styles = { pluginTagSelectStyles }
57
56
options = { tagOptions }
58
57
isMulti
59
58
value = { localSelectedOptions }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { ReactComponent as ICSearch } from '../../../Assets/Icon/ic-search.svg'
5
5
import { ReactComponent as ICFilter } from '../../../Assets/Icon/ic-filter.svg'
6
6
import { ReactComponent as ICFilterApplied } from '../../../Assets/Icon/ic-filter-applied.svg'
7
7
import { OptionType } from '../../../Common'
8
+ import { commonSelectStyles } from '../ReactSelect'
8
9
9
10
const parseMinimalPluginVersionsDTO = (
10
11
pluginVersionData : ParentPluginDTO [ 'pluginVersions' ] [ 'minimalPluginVersionData' ] ,
@@ -117,3 +118,23 @@ export const PluginTagSelectValueContainer = (props: ValueContainerProps<OptionT
117
118
</ components . ValueContainer >
118
119
)
119
120
}
121
+
122
+ // TODO: Should it be in constants?
123
+ export const pluginTagSelectStyles = {
124
+ ...commonSelectStyles ,
125
+ option : ( base , state ) => ( {
126
+ ...base ,
127
+ height : '36px' ,
128
+ padding : '8px 12px' ,
129
+ backgroundColor : state . isFocused ? 'var(--N100)' : 'white' ,
130
+ color : 'var(--N900)' ,
131
+ cursor : 'pointer' ,
132
+ overflow : 'hidden' ,
133
+ textOverflow : 'ellipsis' ,
134
+ whiteSpace : 'nowrap' ,
135
+
136
+ ':active' : {
137
+ backgroundColor : 'var(--N100)' ,
138
+ } ,
139
+ } ) ,
140
+ }
Original file line number Diff line number Diff line change @@ -191,15 +191,17 @@ export const MenuListWithApplyButton = ({
191
191
} : MenuListProps & { handleApplyFilter : ( ) => void } ) => (
192
192
< >
193
193
< components . MenuList { ...props } />
194
- < div className = "p-8 dc__position-sticky dc__bottom-0 dc__border-top-n1 bcn-0 dc__bottom-radius-4" >
195
- < button
196
- type = "button"
197
- className = "dc__unset-button-styles w-100 br-4 h-28 flex bcb-5 cn-0 fw-6 lh-28 fs-12 h-28 br-4 pt-5 pr-12 pb-5 pl-12"
198
- onClick = { handleApplyFilter }
199
- aria-label = "Apply filters"
200
- >
201
- Apply
202
- </ button >
203
- </ div >
194
+ { props . selectProps . options . length > 0 && (
195
+ < div className = "p-8 dc__position-sticky dc__bottom-0 dc__border-top-n1 bcn-0 dc__bottom-radius-4" >
196
+ < button
197
+ type = "button"
198
+ className = "dc__unset-button-styles w-100 br-4 h-28 flex bcb-5 cn-0 fw-6 lh-28 fs-12 h-28 br-4 pt-5 pr-12 pb-5 pl-12"
199
+ onClick = { handleApplyFilter }
200
+ aria-label = "Apply filters"
201
+ >
202
+ Apply
203
+ </ button >
204
+ </ div >
205
+ ) }
204
206
</ >
205
207
)
You can’t perform that action at this time.
0 commit comments