1
- import { Layout , Row } from 'antd' ;
2
- import SelectCountry from 'src/domains/countries/SelectCountry' ;
3
- import styles from './header.module.css' ;
4
- import setLanguage from 'next-translate/setLanguage' ;
5
- import useTranslation from 'next-translate/useTranslation' ;
1
+ import React from 'react'
2
+ import { Layout , Row } from 'antd'
3
+ import SelectCountry from 'src/domains/countries/SelectCountry'
4
+ import styles from './header.module.css'
5
+ import setLanguage from 'next-translate/setLanguage'
6
+ import useTranslation from 'next-translate/useTranslation'
6
7
import { setDefaultOptions } from 'date-fns'
7
- import { getDateFnsLocale } from 'src/helpers/locale' ;
8
- import { removeHyphens } from 'src/helpers/string' ;
8
+ import { getDateFnsLocale } from 'src/helpers/locale'
9
+ import { removeHyphens } from 'src/helpers/string'
9
10
10
-
11
-
12
- const Header = ( ) => {
13
- function onSelectLanguage ( value : string , option : any ) {
14
- setLanguage ( value ) ;
11
+ const Header : React . FunctionComponent = ( ) : JSX . Element => {
12
+ async function onSelectLanguage ( value : string , option : any ) : Promise < void > {
13
+ await setLanguage ( value )
15
14
16
15
const locale = getDateFnsLocale ( removeHyphens ( value ) )
17
16
@@ -20,20 +19,20 @@ const Header = () => {
20
19
} )
21
20
}
22
21
23
- const { lang } = useTranslation ( ) ;
22
+ const { lang } = useTranslation ( )
24
23
25
24
return (
26
25
< Layout . Header >
27
26
< Row justify = "end" align = "middle" className = { styles . headerRow } >
28
27
< SelectCountry
29
- onSelect = { onSelectLanguage }
28
+ handleOnSelect = { onSelectLanguage }
30
29
defaultValue = { lang }
31
30
variableCountryAttribute = "language"
32
31
showFlag = { false }
33
32
/>
34
33
</ Row >
35
34
</ Layout . Header >
36
- ) ;
37
- } ;
35
+ )
36
+ }
38
37
39
- export default Header ;
38
+ export default Header
0 commit comments