File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 3
3
Box ,
4
4
Menu ,
5
5
MenuButton ,
6
+ MenuButtonProps ,
6
7
MenuList ,
7
8
MenuItem ,
8
9
} from "@chakra-ui/react" ;
@@ -16,29 +17,30 @@ import {
16
17
} from "locale" ;
17
18
18
19
interface LocalPickerProps {
19
- /**
20
- * On change handler
21
- */
22
20
onChange ?: any ;
23
- /**
24
- * Class
25
- */
26
21
className ?: string ;
22
+ background ?: "normal" | "transparent" ;
27
23
}
28
24
29
- function LocalePicker ( { onChange, className } : LocalPickerProps ) {
25
+ function LocalePicker ( { onChange, className, background } : LocalPickerProps ) {
30
26
const { locale, setLocale } = useLocaleState ( ) ;
31
27
28
+ const additionalProps : Partial < MenuButtonProps > = { } ;
29
+ if ( background === "transparent" ) {
30
+ additionalProps [ "backgroundColor" ] = "transparent" ;
31
+ }
32
+
32
33
const changeTo = ( lang : string ) => {
33
34
changeLocale ( lang ) ;
34
35
setLocale ( lang ) ;
35
36
onChange && onChange ( locale ) ;
37
+ ___location . reload ( ) ;
36
38
} ;
37
39
38
40
return (
39
41
< Box className = { className } >
40
42
< Menu >
41
- < MenuButton as = { Button } >
43
+ < MenuButton as = { Button } { ... additionalProps } >
42
44
< Flag countryCode = { getFlagCodeForLocale ( locale ) } />
43
45
</ MenuButton >
44
46
< MenuList >
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import {
17
17
useColorModeValue ,
18
18
useDisclosure ,
19
19
} from "@chakra-ui/react" ;
20
- import { ThemeSwitcher } from "components" ;
20
+ import { LocalePicker , ThemeSwitcher } from "components" ;
21
21
import { useAuthState } from "context" ;
22
22
import { useUser } from "hooks" ;
23
23
import { intl } from "locale" ;
@@ -67,6 +67,7 @@ function NavigationHeader({
67
67
</ HStack >
68
68
< HStack >
69
69
< ThemeSwitcher background = "transparent" />
70
+ < LocalePicker className = "text-right" background = "transparent" />
70
71
< Box pl = { 2 } >
71
72
< Menu >
72
73
< MenuButton
You can’t perform that action at this time.
0 commit comments