import React, { Component } from 'react'; import { SelectStyled, UlStyled, LiStyled, LinkActiveStyled } from './IntlSelectStyle'; import { ILocate } from 'app/redux/ducks/locate/types'; import { IStateProps, IDispatchProps } from './types'; import IntlMessages from '../Intl-messages/IntlMessages'; type IProps = IStateProps & IDispatchProps; class IntlSelect extends Component { handleClick(id: string) { const { locateChange } = this.props; locateChange(id); } renderLink(l: ILocate) { const { locate } = this.props; if (locate.data.id === l.id) return this.handleClick(l.id)}>{l.label}; else return this.handleClick(l.id)}>{l.label}; } renderOptions() { const locates: Array = [ { id: 'en', label: 'en' }, { id: 'es', label: 'es' }, { id: 'fr', label: 'fr' }, { id: 'pt-BR', label: 'pt-BR' } ]; return locates.map((l, i) => {this.renderLink(l)}); } render() { return (

:

{this.renderOptions()}
); } } export default IntlSelect;