Merge pull request #899 from matrix-org/luke/improve-country-dd-3

Swap to new flag files (which are stored as GB.png)
This commit is contained in:
Luke Barnard 2017-05-18 13:37:28 +01:00 committed by GitHub
commit 2ebd9b6290

View file

@ -19,7 +19,6 @@ import React from 'react';
import sdk from '../../../index'; import sdk from '../../../index';
import { COUNTRIES } from '../../../phonenumber'; import { COUNTRIES } from '../../../phonenumber';
import { charactersToImageNode } from '../../../HtmlUtils';
const COUNTRIES_BY_ISO2 = new Object(null); const COUNTRIES_BY_ISO2 = new Object(null);
for (const c of COUNTRIES) { for (const c of COUNTRIES) {
@ -42,7 +41,7 @@ export default class CountryDropdown extends React.Component {
this.state = { this.state = {
searchQuery: '', searchQuery: '',
} };
} }
componentWillMount() { componentWillMount() {
@ -65,13 +64,7 @@ export default class CountryDropdown extends React.Component {
} }
_flagImgForIso2(iso2) { _flagImgForIso2(iso2) {
// Unicode Regional Indicator Symbol letter 'A' return <img src={`flags/${iso2}.png`}/>;
const RIS_A = 0x1F1E6;
const ASCII_A = 65;
return charactersToImageNode(iso2, true,
RIS_A + (iso2.charCodeAt(0) - ASCII_A),
RIS_A + (iso2.charCodeAt(1) - ASCII_A),
);
} }
_getShortOption(iso2) { _getShortOption(iso2) {
@ -128,7 +121,7 @@ export default class CountryDropdown extends React.Component {
value={value} searchEnabled={true} value={value} searchEnabled={true}
> >
{options} {options}
</Dropdown> </Dropdown>;
} }
} }