Skip to content

Commit

Permalink
Added list for selection of countries, and add a list for countryname…
Browse files Browse the repository at this point in the history
…s in utils folder
  • Loading branch information
Anubhav-2003 committed Jan 24, 2024
1 parent 79bd263 commit 1b48ee2
Show file tree
Hide file tree
Showing 3 changed files with 239 additions and 14 deletions.
26 changes: 19 additions & 7 deletions src/components/OrgUpdate/OrgUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
InterfaceQueryOrganizationsListObject,
InterfaceAddress,
} from 'utils/interfaces';
import countryOptions from 'utils/countryList';

interface InterfaceOrgUpdateProps {
orgId: string;
Expand Down Expand Up @@ -187,14 +188,25 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element {
<Row className="mb-1">
<Col sm={6} className="mb-3">
<Form.Control
placeholder={t('countryCode')}
autoComplete="off"
required
as="select"
value={formState.address.countryCode}
onChange={(e) =>
handleInputChange('countryCode', e.target.value)
}
/>
onChange={(e) => {
const countryCode = e.target.value;
handleInputChange('countryCode', countryCode);
}}
>
<option value="" disabled>
Select a country
</option>
{countryOptions.map((country) => (
<option
key={country.value.toUpperCase()}
value={country.value.toUpperCase()}
>
{country.label}
</option>
))}
</Form.Control>
</Col>
<Col sm={6} className="mb-3">
<Form.Control
Expand Down
26 changes: 19 additions & 7 deletions src/screens/OrgList/OrganizationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import convertToBase64 from 'utils/convertToBase64';
import type { ChangeEvent } from 'react';
import styles from './OrgList.module.css';
import type { InterfaceAddress } from 'utils/interfaces';
import countryOptions from 'utils/countryList';

/**
* Represents the state of the form in the organization modal.
Expand Down Expand Up @@ -135,14 +136,25 @@ const OrganizationModal: React.FC<InterfaceOrganizationModalProps> = ({
<Row className="mb-1">
<Col sm={6} className="mb-3">
<Form.Control
placeholder={t('countryCode')}
autoComplete="off"
required
as="select"
value={formState.address.countryCode}
onChange={(e) =>
handleInputChange('countryCode', e.target.value)
}
/>
onChange={(e) => {
const countryCode = e.target.value;
handleInputChange('countryCode', countryCode);
}}
>
<option value="" disabled>
Select a country
</option>
{countryOptions.map((country) => (
<option
key={country.value.toUpperCase()}
value={country.value.toUpperCase()}
>
{country.label}
</option>
))}
</Form.Control>
</Col>
<Col sm={6} className="mb-3">
<Form.Control
Expand Down
201 changes: 201 additions & 0 deletions src/utils/countryList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
const countryOptions = [
{ value: 'af', label: 'Afghanistan' },
{ value: 'al', label: 'Albania' },
{ value: 'dz', label: 'Algeria' },
{ value: 'ad', label: 'Andorra' },
{ value: 'ao', label: 'Angola' },
{ value: 'ai', label: 'Anguilla' },
{ value: 'ag', label: 'Antigua and Barbuda' },
{ value: 'ar', label: 'Argentina' },
{ value: 'am', label: 'Armenia' },
{ value: 'aw', label: 'Aruba' },
{ value: 'au', label: 'Australia' },
{ value: 'at', label: 'Austria' },
{ value: 'az', label: 'Azerbaijan' },
{ value: 'bs', label: 'Bahamas' },
{ value: 'bh', label: 'Bahrain' },
{ value: 'bd', label: 'Bangladesh' },
{ value: 'bb', label: 'Barbados' },
{ value: 'by', label: 'Belarus' },
{ value: 'be', label: 'Belgium' },
{ value: 'bz', label: 'Belize' },
{ value: 'bj', label: 'Benin' },
{ value: 'bm', label: 'Bermuda' },
{ value: 'bt', label: 'Bhutan' },
{ value: 'bo', label: 'Bolivia' },
{ value: 'ba', label: 'Bosnia and Herzegovina' },
{ value: 'bw', label: 'Botswana' },
{ value: 'br', label: 'Brazil' },
{ value: 'bn', label: 'Brunei' },
{ value: 'bg', label: 'Bulgaria' },
{ value: 'bf', label: 'Burkina Faso' },
{ value: 'bi', label: 'Burundi' },
{ value: 'cv', label: 'Cabo Verde' },
{ value: 'kh', label: 'Cambodia' },
{ value: 'cm', label: 'Cameroon' },
{ value: 'ca', label: 'Canada' },
{ value: 'ky', label: 'Cayman Islands' },
{ value: 'cf', label: 'Central African Republic' },
{ value: 'td', label: 'Chad' },
{ value: 'cl', label: 'Chile' },
{ value: 'cn', label: 'China' },
{ value: 'co', label: 'Colombia' },
{ value: 'km', label: 'Comoros' },
{ value: 'cg', label: 'Congo' },
{ value: 'cr', label: 'Costa Rica' },
{ value: 'hr', label: 'Croatia' },
{ value: 'cu', label: 'Cuba' },
{ value: 'cy', label: 'Cyprus' },
{ value: 'cz', label: 'Czechia' },
{ value: 'dk', label: 'Denmark' },
{ value: 'dj', label: 'Djibouti' },
{ value: 'dm', label: 'Dominica' },
{ value: 'do', label: 'Dominican Republic' },
{ value: 'ec', label: 'Ecuador' },
{ value: 'eg', label: 'Egypt' },
{ value: 'sv', label: 'El Salvador' },
{ value: 'gq', label: 'Equatorial Guinea' },
{ value: 'er', label: 'Eritrea' },
{ value: 'ee', label: 'Estonia' },
{ value: 'et', label: 'Ethiopia' },
{ value: 'fj', label: 'Fiji' },
{ value: 'fi', label: 'Finland' },
{ value: 'fr', label: 'France' },
{ value: 'ga', label: 'Gabon' },
{ value: 'gm', label: 'Gambia' },
{ value: 'ge', label: 'Georgia' },
{ value: 'de', label: 'Germany' },
{ value: 'gh', label: 'Ghana' },
{ value: 'gi', label: 'Gibraltar' },
{ value: 'gr', label: 'Greece' },
{ value: 'gl', label: 'Greenland' },
{ value: 'gd', label: 'Grenada' },
{ value: 'gt', label: 'Guatemala' },
{ value: 'gn', label: 'Guinea' },
{ value: 'gw', label: 'Guinea-Bissau' },
{ value: 'gy', label: 'Guyana' },
{ value: 'ht', label: 'Haiti' },
{ value: 'hn', label: 'Honduras' },
{ value: 'hu', label: 'Hungary' },
{ value: 'is', label: 'Iceland' },
{ value: 'in', label: 'India' },
{ value: 'id', label: 'Indonesia' },
{ value: 'ir', label: 'Iran' },
{ value: 'iq', label: 'Iraq' },
{ value: 'ie', label: 'Ireland' },
{ value: 'il', label: 'Israel' },
{ value: 'it', label: 'Italy' },
{ value: 'jm', label: 'Jamaica' },
{ value: 'jp', label: 'Japan' },
{ value: 'jo', label: 'Jordan' },
{ value: 'kz', label: 'Kazakhstan' },
{ value: 'ke', label: 'Kenya' },
{ value: 'ki', label: 'Kiribati' },
{ value: 'kw', label: 'Kuwait' },
{ value: 'kg', label: 'Kyrgyzstan' },
{ value: 'la', label: 'Laos' },
{ value: 'lv', label: 'Latvia' },
{ value: 'lb', label: 'Lebanon' },
{ value: 'ls', label: 'Lesotho' },
{ value: 'lr', label: 'Liberia' },
{ value: 'ly', label: 'Libya' },
{ value: 'li', label: 'Liechtenstein' },
{ value: 'lt', label: 'Lithuania' },
{ value: 'lu', label: 'Luxembourg' },
{ value: 'mk', label: 'North Macedonia' },
{ value: 'mg', label: 'Madagascar' },
{ value: 'mw', label: 'Malawi' },
{ value: 'my', label: 'Malaysia' },
{ value: 'mv', label: 'Maldives' },
{ value: 'ml', label: 'Mali' },
{ value: 'mt', label: 'Malta' },
{ value: 'mh', label: 'Marshall Islands' },
{ value: 'mr', label: 'Mauritania' },
{ value: 'mu', label: 'Mauritius' },
{ value: 'mx', label: 'Mexico' },
{ value: 'fm', label: 'Micronesia' },
{ value: 'md', label: 'Moldova' },
{ value: 'mc', label: 'Monaco' },
{ value: 'mn', label: 'Mongolia' },
{ value: 'me', label: 'Montenegro' },
{ value: 'ma', label: 'Morocco' },
{ value: 'mz', label: 'Mozambique' },
{ value: 'mm', label: 'Myanmar' },
{ value: 'na', label: 'Namibia' },
{ value: 'nr', label: 'Nauru' },
{ value: 'np', label: 'Nepal' },
{ value: 'nl', label: 'Netherlands' },
{ value: 'nz', label: 'New Zealand' },
{ value: 'ni', label: 'Nicaragua' },
{ value: 'ne', label: 'Niger' },
{ value: 'ng', label: 'Nigeria' },
{ value: 'kp', label: 'North Korea' },
{ value: 'no', label: 'Norway' },
{ value: 'om', label: 'Oman' },
{ value: 'pk', label: 'Pakistan' },
{ value: 'pw', label: 'Palau' },
{ value: 'pa', label: 'Panama' },
{ value: 'pg', label: 'Papua New Guinea' },
{ value: 'py', label: 'Paraguay' },
{ value: 'pe', label: 'Peru' },
{ value: 'ph', label: 'Philippines' },
{ value: 'pl', label: 'Poland' },
{ value: 'pt', label: 'Portugal' },
{ value: 'qa', label: 'Qatar' },
{ value: 'ro', label: 'Romania' },
{ value: 'ru', label: 'Russia' },
{ value: 'rw', label: 'Rwanda' },
{ value: 'lc', label: 'Saint Lucia' },
{ value: 'vc', label: 'Saint Vincent and the Grenadines' },
{ value: 'ws', label: 'Samoa' },
{ value: 'sm', label: 'San Marino' },
{ value: 'st', label: 'Sao Tome and Principe' },
{ value: 'sa', label: 'Saudi Arabia' },
{ value: 'sn', label: 'Senegal' },
{ value: 'rs', label: 'Serbia' },
{ value: 'sc', label: 'Seychelles' },
{ value: 'sl', label: 'Sierra Leone' },
{ value: 'sg', label: 'Singapore' },
{ value: 'sk', label: 'Slovakia' },
{ value: 'si', label: 'Slovenia' },
{ value: 'sb', label: 'Solomon Islands' },
{ value: 'so', label: 'Somalia' },
{ value: 'za', label: 'South Africa' },
{ value: 'kr', label: 'South Korea' },
{ value: 'ss', label: 'South Sudan' },
{ value: 'es', label: 'Spain' },
{ value: 'lk', label: 'Sri Lanka' },
{ value: 'sd', label: 'Sudan' },
{ value: 'sr', label: 'Suriname' },
{ value: 'sz', label: 'Eswatini' },
{ value: 'se', label: 'Sweden' },
{ value: 'ch', label: 'Switzerland' },
{ value: 'sy', label: 'Syria' },
{ value: 'tw', label: 'Taiwan' },
{ value: 'tj', label: 'Tajikistan' },
{ value: 'tz', label: 'Tanzania' },
{ value: 'th', label: 'Thailand' },
{ value: 'tl', label: 'Timor-Leste' },
{ value: 'tg', label: 'Togo' },
{ value: 'to', label: 'Tonga' },
{ value: 'tt', label: 'Trinidad and Tobago' },
{ value: 'tn', label: 'Tunisia' },
{ value: 'tr', label: 'Turkey' },
{ value: 'tm', label: 'Turkmenistan' },
{ value: 'tv', label: 'Tuvalu' },
{ value: 'ug', label: 'Uganda' },
{ value: 'ua', label: 'Ukraine' },
{ value: 'ae', label: 'United Arab Emirates' },
{ value: 'gb', label: 'United Kingdom' },
{ value: 'us', label: 'United States' },
{ value: 'uy', label: 'Uruguay' },
{ value: 'uz', label: 'Uzbekistan' },
{ value: 'vu', label: 'Vanuatu' },
{ value: 'va', label: 'Vatican City' },
{ value: 've', label: 'Venezuela' },
{ value: 'vn', label: 'Vietnam' },
{ value: 'ye', label: 'Yemen' },
{ value: 'zm', label: 'Zambia' },
{ value: 'zw', label: 'Zimbabwe' },
];
export default countryOptions;

0 comments on commit 1b48ee2

Please sign in to comment.