import React from 'react'; import classnames from 'classnames'; import { connect } from 'react-redux'; import { languages } from 'config'; import { AppState } from 'features/reducers'; import { getLanguageSelection, TChangeLanguage, changeLanguage } from 'features/config'; 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);