Skip to content

Commit

Permalink
country icons added to the Account Settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasminDreasond committed Jun 27, 2024
1 parent 273e542 commit 29e5fb3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/app/molecules/setting-phone/SettingPhone.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
getCountryCallingCode,
parsePhoneNumber,
} from 'libphonenumber-js';
import { getFlagEmoji } from '@src/util/tools';

export const SettingPhone = React.forwardRef(
(
Expand Down Expand Up @@ -116,14 +117,16 @@ export const SettingPhone = React.forwardRef(
<div className="input-group input-group-phone">
<span className="form-phone-code input-group-text">
<select disabled={disabled} ref={selectChange} className="form-select form-control-bg">
<option>??</option>
<option>?? 🌐</option>
{countries.map((item, index) => (
<option
key={`${item}_${index}`}
value={item}
selected={item === country ? true : false}
>
{item}
{` `}
{getFlagEmoji(item)}
</option>
))}
</select>
Expand Down
2 changes: 1 addition & 1 deletion src/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ audio:not([controls]) {
height: 44px !important;
margin-top: 8px;
margin-bottom: 4px;
width: 100px;
width: 80px;
padding: 0px;
border: 0px solid transparent;
> .form-select {
Expand Down
8 changes: 8 additions & 0 deletions src/util/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,14 @@ export function cyrb128(str) {
return [h1 >>> 0, h2 >>> 0, h3 >>> 0, h4 >>> 0];
}

export function getFlagEmoji(countryCode) {
const codePoints = countryCode
.toUpperCase()
.split('')
.map((char) => 127397 + char.charCodeAt());
return String.fromCodePoint(...codePoints);
}

// eslint-disable-next-line no-extend-native
Date.prototype.isValid = function () {
// If the date object is invalid it
Expand Down

0 comments on commit 29e5fb3

Please sign in to comment.