Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
665eeff7
Commit
665eeff7
authored
May 13, 2020
by
Ben Wheeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move country name lookup to library
parent
1bab2bb5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
src/components/registration/steps.jsx
src/components/registration/steps.jsx
+1
-1
src/lib/country-data.js
src/lib/country-data.js
+4
-0
No files found.
src/components/registration/steps.jsx
View file @
665eeff7
...
@@ -466,7 +466,7 @@ class DemographicsStep extends React.Component {
...
@@ -466,7 +466,7 @@ class DemographicsStep extends React.Component {
// look up country code from country label ('United States' -> 'us')
// look up country code from country label ('United States' -> 'us')
// if `countryName` is not found, including if it's null or undefined, then this function will return undefined.
// if `countryName` is not found, including if it's null or undefined, then this function will return undefined.
getCountryCode
(
countryName
)
{
getCountryCode
(
countryName
)
{
const
country
=
countryData
.
countryInfo
.
find
(
countryItem
=>
countryItem
.
name
===
countryName
);
const
country
=
countryData
.
lookupCountryName
(
countryName
);
return
country
&&
country
.
code
;
return
country
&&
country
.
code
;
}
}
handleValidSubmit
(
formData
)
{
handleValidSubmit
(
formData
)
{
...
...
src/lib/country-data.js
View file @
665eeff7
...
@@ -1040,6 +1040,10 @@ module.exports.lookupCountryInfo = countryCode => (
...
@@ -1040,6 +1040,10 @@ module.exports.lookupCountryInfo = countryCode => (
countryInfo
.
find
(
country
=>
country
.
code
===
countryCode
)
countryInfo
.
find
(
country
=>
country
.
code
===
countryCode
)
);
);
module
.
exports
.
lookupCountryName
=
countryName
=>
(
countryInfo
.
find
(
country
=>
country
.
name
===
countryName
)
);
/**
/**
* Function dupeCommonCountries():
* Function dupeCommonCountries():
* takes startingCountryInfo, and duplicates any number of its country labels
* takes startingCountryInfo, and duplicates any number of its country labels
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment