import React from 'react'; import classnames from 'classnames'; import { connect } from 'react-redux'; import { languages } from 'config'; import { TChangeLanguage, changeLanguage } from 'actions/config'; import { getLanguageSelection } from 'selectors/config'; import { AppState } from 'reducers'; import './LanguageSelect.scss'; interface OwnProps { closePanel(): void; } interface StateProps { languageSelection: string; } interface DispatchProps { changeLanguage: TChangeLanguage; } type Props = OwnProps & StateProps & DispatchProps; class LanguageSelect extends React.Component { public render() { const { languageSelection } = this.props; return (
{Object.entries(languages).map(lang => ( ))}
); } private handleLanguageSelect = (lang: string) => { this.props.changeLanguage(lang); this.props.closePanel(); }; } export default connect( (state: AppState): StateProps => ({ languageSelection: getLanguageSelection(state) }), { changeLanguage } )(LanguageSelect);