Skip to content

Commit

Permalink
add emoji flag to options
Browse files Browse the repository at this point in the history
  • Loading branch information
seeratsekhon committed Jul 21, 2018
1 parent 0427f2c commit 87c2ee2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions client/components/WelcomeModal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Modal, Button, FormControl, FormGroup, ControlLabel } from 'react-bootstrap';
import countries from '../data/countries';
import countries from '../data/countries.json';

const listOfCountries = [];

Expand All @@ -17,9 +17,11 @@ class WelcomeModal extends React.Component {
}

componentWillMount() {
Object.keys(countries).forEach((key) => {
listOfCountries.push(<option value={countries[key]}>{countries[key]}</option>);
});
if (listOfCountries.length === 0) {
Object.keys(countries).forEach((key) => {
listOfCountries.push(<option value={countries[key]} key={key}>{countries[key]} {key.toUpperCase().replace(/./g, char => String.fromCodePoint(char.charCodeAt(0) + 127397))} </option>);
});
}
}

componentDidMount() {
Expand Down Expand Up @@ -62,7 +64,7 @@ class WelcomeModal extends React.Component {
<ControlLabel> Country</ControlLabel>

<FormControl componentClass="select" value={this.state.country} onChange={this.handleSelect}>
<option value="None">None</option>
<option value="None" key="None">None</option>
{listOfCountries}
</FormControl>
</FormGroup>
Expand Down

0 comments on commit 87c2ee2

Please sign in to comment.