17
17
import { useEffect , useMemo , useRef , useState } from 'react'
18
18
import { ReactComponent as ICFilter } from '@Icons/ic-filter.svg'
19
19
import { ReactComponent as ICFilterApplied } from '@Icons/ic-filter-applied.svg'
20
- import { ComponentSizeType } from '@Shared/constants'
21
20
import { useRegisterShortcut , UseRegisterShortcutProvider } from '@Common/Hooks'
22
21
import { IS_PLATFORM_MAC_OS } from '@Common/Constants'
23
22
import { SupportedKeyboardKeysType } from '@Common/Hooks/UseRegisterShortcut/types'
24
23
import SelectPicker from './SelectPicker.component'
25
24
import { FilterSelectPickerProps , SelectPickerOptionType , SelectPickerProps } from './type'
26
- import { Button , ButtonProps , useTriggerAutoClickTimestamp } from '../Button'
25
+ import { ButtonProps , ButtonVariantType , useTriggerAutoClickTimestamp } from '../Button'
27
26
28
27
const APPLY_FILTER_SHORTCUT_KEYS : SupportedKeyboardKeysType [ ] = [ IS_PLATFORM_MAC_OS ? 'Meta' : 'Control' , 'Enter' ]
29
28
@@ -92,26 +91,6 @@ const FilterSelectPicker = ({
92
91
}
93
92
}
94
93
95
- const renderApplyButton = ( ) => (
96
- < div className = "p-8 dc__border-top-n1" >
97
- < Button
98
- text = "Apply"
99
- dataTestId = "filter-select-picker-apply"
100
- onClick = { handleApplyClick }
101
- size = { ComponentSizeType . small }
102
- fullWidth
103
- showTooltip
104
- tooltipProps = { {
105
- shortcutKeyCombo : {
106
- text : 'Apply filter' ,
107
- combo : APPLY_FILTER_SHORTCUT_KEYS ,
108
- } ,
109
- } }
110
- triggerAutoClickTimestamp = { triggerAutoClickTimestamp }
111
- />
112
- </ div >
113
- )
114
-
115
94
useEffect ( ( ) => {
116
95
if ( isMenuOpen ) {
117
96
registerShortcut ( { keys : APPLY_FILTER_SHORTCUT_KEYS , callback : handleApplyClick as ( ) => void } )
@@ -134,7 +113,23 @@ const FilterSelectPicker = ({
134
113
onMenuOpen = { openMenu }
135
114
onMenuClose = { handleMenuClose }
136
115
onChange = { handleSelectOnChange }
137
- renderMenuListFooter = { renderApplyButton }
116
+ menuListFooterConfig = { {
117
+ type : 'button' ,
118
+ buttonProps : {
119
+ text : 'Apply' ,
120
+ dataTestId : 'filter-select-picker-apply' ,
121
+ onClick : handleApplyClick ,
122
+ showTooltip : true ,
123
+ tooltipProps : {
124
+ shortcutKeyCombo : {
125
+ text : 'Apply filter' ,
126
+ combo : APPLY_FILTER_SHORTCUT_KEYS ,
127
+ } ,
128
+ } ,
129
+ triggerAutoClickTimestamp,
130
+ variant : ButtonVariantType . primary ,
131
+ } ,
132
+ } }
138
133
controlShouldRenderValue = { false }
139
134
showSelectedOptionsCount
140
135
isSearchable
0 commit comments