11import React from 'react' ;
22import { useTranslation } from 'react-i18next' ;
33import { Select } from '@ui5/webcomponents-react' ;
4- import RenderOption from './RenderOption' ;
4+ import StatusFilterOption , {
5+ StatusFilterOptionProps ,
6+ } from './StatusFilterOption' ;
57
68interface StatusFilterProps {
79 column : {
@@ -10,32 +12,28 @@ interface StatusFilterProps {
1012 } ;
1113}
1214
13- interface OptionConfig {
14- value : string ;
15- iconName : string ;
16- color : string ;
17- labelKey : string ;
18- }
15+ const options : Pick <
16+ StatusFilterOptionProps ,
17+ 'value' | 'iconName' | 'color' | 'labelKey'
18+ > [ ] = [
19+ { value : 'all' , iconName : 'filter' , color : 'gray' , labelKey : 'All' } ,
20+ {
21+ value : 'true' ,
22+ iconName : 'sys-enter-2' ,
23+ color : 'green' ,
24+ labelKey : 'Enabled' ,
25+ } ,
26+ {
27+ value : 'false' ,
28+ iconName : 'sys-cancel-2' ,
29+ color : 'red' ,
30+ labelKey : 'Disabled' ,
31+ } ,
32+ ] ;
1933
2034const StatusFilter : React . FC < StatusFilterProps > = ( { column } ) => {
2135 const { t } = useTranslation ( ) ;
2236
23- const options : OptionConfig [ ] = [
24- { value : 'all' , iconName : 'filter' , color : 'gray' , labelKey : 'All' } ,
25- {
26- value : 'true' ,
27- iconName : 'sys-enter-2' ,
28- color : 'green' ,
29- labelKey : 'Enabled' ,
30- } ,
31- {
32- value : 'false' ,
33- iconName : 'sys-cancel-2' ,
34- color : 'red' ,
35- labelKey : 'Disabled' ,
36- } ,
37- ] ;
38-
3937 const handleChange = (
4038 e : CustomEvent < { selectedOption : { dataset ?: { value ?: string } } } > ,
4139 ) => {
@@ -46,7 +44,7 @@ const StatusFilter: React.FC<StatusFilterProps> = ({ column }) => {
4644 return (
4745 < Select onChange = { handleChange } >
4846 { options . map ( ( option ) => (
49- < RenderOption
47+ < StatusFilterOption
5048 key = { option . value }
5149 { ...option }
5250 t = { t }
0 commit comments