File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed
components/filter/search-button Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 1
- import { Button } from '@mantine/core' ;
1
+ import { ActionIcon , Button , Menu } from '@mantine/core' ;
2
+ import { IconChevronDown , IconRefresh } from '@tabler/icons-react' ;
3
+ import { useTranslation } from 'react-i18next' ;
2
4
import { useDashboardThemeContext } from '~/contexts' ;
3
5
import { RenderSearchButtonProps } from '~/index' ;
4
6
5
7
export const SearchButton = ( { disabled, onSubmit } : RenderSearchButtonProps ) => {
8
+ const { t } = useTranslation ( ) ;
6
9
const { renderSearchButton } = useDashboardThemeContext ( ) ;
7
10
if ( renderSearchButton ) {
8
11
return renderSearchButton ( { disabled, onSubmit } ) ;
9
12
}
10
13
return (
11
- < Button color = "blue" size = "sm" onClick = { ( ) => onSubmit ( ) } disabled = { disabled } >
12
- Search
13
- </ Button >
14
+ < Button . Group >
15
+ < Button color = "blue" size = "sm" onClick = { ( ) => onSubmit ( ) } disabled = { disabled } >
16
+ { t ( 'common.actions.search' ) }
17
+ </ Button >
18
+ < Menu trigger = "hover" disabled = { disabled } position = "bottom-end" >
19
+ < Menu . Target >
20
+ < Button
21
+ disabled = { disabled }
22
+ color = "blue"
23
+ px = "xs"
24
+ style = { { borderLeft : `1px solid ${ disabled ? 'white' : 'var(--mantine-color-gray-4)' } ` } }
25
+ >
26
+ < IconChevronDown size = { 16 } />
27
+ </ Button >
28
+ </ Menu . Target >
29
+ < Menu . Dropdown >
30
+ < Menu . Item
31
+ leftSection = { < IconRefresh size = { 14 } /> }
32
+ disabled = { disabled }
33
+ onClick = { ( ) => onSubmit ( { force : true } ) }
34
+ >
35
+ { t ( 'common.actions.reload' ) }
36
+ </ Menu . Item >
37
+ </ Menu . Dropdown >
38
+ </ Menu >
39
+ </ Button . Group >
14
40
) ;
15
41
} ;
Original file line number Diff line number Diff line change @@ -299,6 +299,8 @@ export const en = {
299
299
copied : 'Copied to clipboard' ,
300
300
action : 'Action' ,
301
301
actions : {
302
+ search : 'Search' ,
303
+ reload : 'Reload' ,
302
304
actions : 'Actions' ,
303
305
open : 'Open' ,
304
306
close : 'Close' ,
Original file line number Diff line number Diff line change @@ -299,6 +299,8 @@ export const zh = {
299
299
copied : '已复制到剪切板' ,
300
300
action : '操作' ,
301
301
actions : {
302
+ search : '查询' ,
303
+ reload : '刷新' ,
302
304
actions : '操作' ,
303
305
open : '打开' ,
304
306
close : '关闭' ,
You can’t perform that action at this time.
0 commit comments