1
1
import '@ui5/webcomponents-icons/dist/icons/search' ;
2
2
import { createComponentStyles } from '@ui5/webcomponents-react-base/lib/createComponentStyles' ;
3
- import { useI18nBundle } from '@ui5/webcomponents-react-base/lib/hooks' ;
3
+ import { useI18nText } from '@ui5/webcomponents-react-base/lib/hooks' ;
4
4
import { enrichEventWithDetails } from '@ui5/webcomponents-react-base/lib/Utils' ;
5
5
import {
6
6
BASIC ,
@@ -59,7 +59,24 @@ export const FilterDialog = (props) => {
59
59
const dialogRefs = useRef ( { } ) ;
60
60
const dialogRef = useRef ( ) ;
61
61
62
- const i18nBundle = useI18nBundle ( '@ui5/webcomponents-react' ) ;
62
+ const [
63
+ basicText ,
64
+ cancelText ,
65
+ clearText ,
66
+ restoreText ,
67
+ saveText ,
68
+ searchForFiltersText ,
69
+ showOnFilterBarText
70
+ ] = useI18nText (
71
+ '@ui5/webcomponents-react' ,
72
+ BASIC ,
73
+ CANCEL ,
74
+ CLEAR ,
75
+ RESTORE ,
76
+ SAVE ,
77
+ SEARCH_FOR_FILTERS ,
78
+ SHOW_ON_FILTER_BAR
79
+ ) ;
63
80
64
81
useEffect ( ( ) => {
65
82
if ( open ) {
@@ -132,11 +149,11 @@ export const FilterDialog = (props) => {
132
149
Go
133
150
</ Button >
134
151
) }
135
- { showClearButton && < Button onClick = { handleClearFilters } > { i18nBundle . getText ( CLEAR ) } </ Button > }
136
- { showRestoreButton && < Button onClick = { handleRestore } > { i18nBundle . getText ( RESTORE ) } </ Button > }
137
- < Button onClick = { handleSave } > { i18nBundle . getText ( SAVE ) } </ Button >
152
+ { showClearButton && < Button onClick = { handleClearFilters } > { clearText } </ Button > }
153
+ { showRestoreButton && < Button onClick = { handleRestore } > { restoreText } </ Button > }
154
+ < Button onClick = { handleSave } > { saveText } </ Button >
138
155
< Button design = { ButtonDesign . Transparent } onClick = { handleCancel } >
139
- { i18nBundle . getText ( CANCEL ) }
156
+ { cancelText }
140
157
</ Button >
141
158
</ FlexBox >
142
159
) ,
@@ -162,11 +179,7 @@ export const FilterDialog = (props) => {
162
179
< FlexBox direction = { FlexBoxDirection . Column } className = { classes . header } >
163
180
< Title level = { TitleLevel . H4 } > Filters</ Title >
164
181
{ showSearch && (
165
- < Input
166
- placeholder = { i18nBundle . getText ( SEARCH_FOR_FILTERS ) }
167
- onInput = { handleSearch }
168
- icon = { < Icon name = "search" /> }
169
- />
182
+ < Input placeholder = { searchForFiltersText } onInput = { handleSearch } icon = { < Icon name = "search" /> } />
170
183
) }
171
184
</ FlexBox >
172
185
) ,
@@ -244,9 +257,9 @@ export const FilterDialog = (props) => {
244
257
< div className = { classes . groupContainer } key = { item } >
245
258
< FlexBox justifyContent = { FlexBoxJustifyContent . SpaceBetween } alignItems = { FlexBoxAlignItems . Center } >
246
259
< Title level = { TitleLevel . H5 } className = { index === 0 ? classes . groupTitle : '' } >
247
- { item === 'default' ? i18nBundle . getText ( BASIC ) : item }
260
+ { item === 'default' ? basicText : item }
248
261
</ Title >
249
- { index === 0 && < Text wrapping = { false } > { i18nBundle . getText ( SHOW_ON_FILTER_BAR ) } </ Text > }
262
+ { index === 0 && < Text wrapping = { false } > { showOnFilterBarText } </ Text > }
250
263
</ FlexBox >
251
264
< div className = { classes . filters } > { filters } </ div >
252
265
</ div >
0 commit comments