Skip to content

Commit 2466569

Browse files
committed
feat: use menuListFooterConfig in filter select picker
1 parent ed37b0e commit 2466569

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

src/Shared/Components/SelectPicker/FilterSelectPicker.tsx

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
import { useEffect, useMemo, useRef, useState } from 'react'
1818
import { ReactComponent as ICFilter } from '@Icons/ic-filter.svg'
1919
import { ReactComponent as ICFilterApplied } from '@Icons/ic-filter-applied.svg'
20-
import { ComponentSizeType } from '@Shared/constants'
2120
import { useRegisterShortcut, UseRegisterShortcutProvider } from '@Common/Hooks'
2221
import { IS_PLATFORM_MAC_OS } from '@Common/Constants'
2322
import { SupportedKeyboardKeysType } from '@Common/Hooks/UseRegisterShortcut/types'
2423
import SelectPicker from './SelectPicker.component'
2524
import { FilterSelectPickerProps, SelectPickerOptionType, SelectPickerProps } from './type'
26-
import { Button, ButtonProps, useTriggerAutoClickTimestamp } from '../Button'
25+
import { ButtonProps, ButtonVariantType, useTriggerAutoClickTimestamp } from '../Button'
2726

2827
const APPLY_FILTER_SHORTCUT_KEYS: SupportedKeyboardKeysType[] = [IS_PLATFORM_MAC_OS ? 'Meta' : 'Control', 'Enter']
2928

@@ -92,26 +91,6 @@ const FilterSelectPicker = ({
9291
}
9392
}
9493

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-
11594
useEffect(() => {
11695
if (isMenuOpen) {
11796
registerShortcut({ keys: APPLY_FILTER_SHORTCUT_KEYS, callback: handleApplyClick as () => void })
@@ -134,7 +113,23 @@ const FilterSelectPicker = ({
134113
onMenuOpen={openMenu}
135114
onMenuClose={handleMenuClose}
136115
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+
}}
138133
controlShouldRenderValue={false}
139134
showSelectedOptionsCount
140135
isSearchable

0 commit comments

Comments
 (0)