Skip to content

Commit 29e5fb3

Browse files
country icons added to the Account Settings.
1 parent 273e542 commit 29e5fb3

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/app/molecules/setting-phone/SettingPhone.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
getCountryCallingCode,
77
parsePhoneNumber,
88
} from 'libphonenumber-js';
9+
import { getFlagEmoji } from '@src/util/tools';
910

1011
export const SettingPhone = React.forwardRef(
1112
(
@@ -116,14 +117,16 @@ export const SettingPhone = React.forwardRef(
116117
<div className="input-group input-group-phone">
117118
<span className="form-phone-code input-group-text">
118119
<select disabled={disabled} ref={selectChange} className="form-select form-control-bg">
119-
<option>??</option>
120+
<option>?? 🌐</option>
120121
{countries.map((item, index) => (
121122
<option
122123
key={`${item}_${index}`}
123124
value={item}
124125
selected={item === country ? true : false}
125126
>
126127
{item}
128+
{` `}
129+
{getFlagEmoji(item)}
127130
</option>
128131
))}
129132
</select>

src/scss/index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ audio:not([controls]) {
137137
height: 44px !important;
138138
margin-top: 8px;
139139
margin-bottom: 4px;
140-
width: 100px;
140+
width: 80px;
141141
padding: 0px;
142142
border: 0px solid transparent;
143143
> .form-select {

src/util/tools.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,14 @@ export function cyrb128(str) {
585585
return [h1 >>> 0, h2 >>> 0, h3 >>> 0, h4 >>> 0];
586586
}
587587

588+
export function getFlagEmoji(countryCode) {
589+
const codePoints = countryCode
590+
.toUpperCase()
591+
.split('')
592+
.map((char) => 127397 + char.charCodeAt());
593+
return String.fromCodePoint(...codePoints);
594+
}
595+
588596
// eslint-disable-next-line no-extend-native
589597
Date.prototype.isValid = function () {
590598
// If the date object is invalid it

0 commit comments

Comments
 (0)