1- import PropTypes from 'prop-types' ;
21import React from 'react' ;
3- import { matchShape , routerShape } from 'found' ;
2+ import { matchShape } from 'found' ;
43import { useIntl } from 'react-intl' ;
5- import connectToStores from 'fluxible-addons-react/connectToStores' ;
64import { configShape } from '../util/shapes' ;
5+ import { useConfigContext } from '../configurations/ConfigContext' ;
76
87const language = ( lang , highlight , match , intl ) => {
98 const aria = highlight
@@ -25,36 +24,21 @@ const language = (lang, highlight, match, intl) => {
2524 ) ;
2625} ;
2726
28- const LangSelect = ( { currentLanguage } , { config, match } ) => {
27+ const LangSelect = ( { } , { match } ) => { // eslint-disable-line
28+ const config = useConfigContext ( ) ;
2929 const intl = useIntl ( ) ;
3030 return (
3131 < div key = "lang-select" id = "lang-select" >
3232 { config . availableLanguages . map ( lang =>
33- language ( lang , lang === currentLanguage , match , intl ) ,
33+ language ( lang , lang === config . language , match , intl ) ,
3434 ) }
3535 </ div >
3636 ) ;
3737} ;
3838
39- LangSelect . displayName = 'LangSelect' ;
40-
41- LangSelect . propTypes = {
42- currentLanguage : PropTypes . string . isRequired ,
43- } ;
44-
4539LangSelect . contextTypes = {
46- executeAction : PropTypes . func . isRequired ,
4740 config : configShape . isRequired ,
48- router : routerShape . isRequired ,
4941 match : matchShape . isRequired ,
5042} ;
5143
52- const connected = connectToStores (
53- LangSelect ,
54- [ 'PreferencesStore' ] ,
55- context => ( {
56- currentLanguage : context . getStore ( 'PreferencesStore' ) . getLanguage ( ) ,
57- } ) ,
58- ) ;
59-
60- export { connected as default , LangSelect as Component } ;
44+ export default LangSelect ;
0 commit comments