|
1 | | -import { Icon, Option, Select } from '@ui5/webcomponents-react'; |
| 1 | +import React from 'react'; |
2 | 2 | import { useTranslation } from 'react-i18next'; |
3 | | -import styles from './StatusFilter.module.css'; |
| 3 | +import { Select } from '@ui5/webcomponents-react'; |
| 4 | +import RenderOption from './RenderOption'; |
4 | 5 |
|
5 | 6 | interface StatusFilterProps { |
6 | 7 | column: { |
7 | 8 | filterValue?: string; |
8 | | - setFilter?: (value?: string | undefined) => void; |
| 9 | + setFilter?: (value?: string) => void; |
9 | 10 | }; |
10 | 11 | } |
11 | 12 |
|
@@ -42,23 +43,21 @@ const StatusFilter: React.FC<StatusFilterProps> = ({ column }) => { |
42 | 43 | column.setFilter?.(value === 'all' ? undefined : value); |
43 | 44 | }; |
44 | 45 |
|
45 | | - const renderOption = ({ value, iconName, color, labelKey }: OptionConfig) => ( |
46 | | - <Option |
47 | | - key={value} |
48 | | - data-value={value} |
49 | | - selected={ |
50 | | - column.filterValue === value || (value === 'all' && !column.filterValue) |
51 | | - } |
52 | | - className={styles.option} |
53 | | - > |
54 | | - <div className={styles.container}> |
55 | | - <Icon name={iconName} style={{ color }} className={styles.icon} /> |
56 | | - <span className={styles.label}>{t(labelKey)}</span> |
57 | | - </div> |
58 | | - </Option> |
| 46 | + return ( |
| 47 | + <Select onChange={handleChange}> |
| 48 | + {options.map((option) => ( |
| 49 | + <RenderOption |
| 50 | + key={option.value} |
| 51 | + {...option} |
| 52 | + t={t} |
| 53 | + isSelected={ |
| 54 | + column.filterValue === option.value || |
| 55 | + (option.value === 'all' && !column.filterValue) |
| 56 | + } |
| 57 | + /> |
| 58 | + ))} |
| 59 | + </Select> |
59 | 60 | ); |
60 | | - |
61 | | - return <Select onChange={handleChange}>{options.map(renderOption)}</Select>; |
62 | 61 | }; |
63 | 62 |
|
64 | 63 | export default StatusFilter; |
0 commit comments