Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOFF-160: Create postcode lookup component #466

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ coverage
build/Release
node_modules
.emails
.vscode
1 change: 1 addition & 0 deletions components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module.exports = {
addressLookup: require('./address-lookup'),
postcodeLookup: require('./postcode-lookup'),
clearSession: require('./clear-session'),
combineAndLoopFields: require('./combine-and-loop-fields'),
date: require('./date'),
Expand Down
31 changes: 31 additions & 0 deletions components/postcode-lookup/defaults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint max-len: 0, no-process-env: 0 */

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either the naming of the file or the exported object structure can be improved. It looks like the file is just default error messages, so you can either rename the file to something like defaultErrorMessages.js or change the structure of the object returned to something like:

`module.exports = {
errorMessages: {
CANT_FIND: '...',
...;
}

}`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now moved the variables linked to an issue with the postcode lookup to within the POSTCODE_ERROR structure within this file. The rest of the properties are not issues with the lookup, so have kept them as independent variables.

'use strict';

module.exports = {
CANT_FIND: 'I cannot find the correct address',
CHANGE: 'Change postcode',
SEARCH_BY_POSTCODE: 'Search address by postcode',
POSTCODE_HEADING: 'What is your UK postcode?',
POSTCODE_LABEL: 'Postcode',
POSTCODE_HINT: 'Enter a full UK postcode, for example AA3 1AB',
ADDRESS_LOOKUP_HEADING: 'Select the main applicant’s address',
MANUAL_ADDRESS_HEADING: 'Enter the main applicant’s address',
MANUAL_ADDRESS_PARAGRAPH: 'This must match the applicant’s address in Home Office records.',
SEARCH_ERROR_HEADING: 'Sorry, there is a problem with the postcode search',
SELECT_LABEL: 'Select the address',
ADDRESS_LINE_1_LABEL: 'Address line 1',
ADDRESS_LINE_2_LABEL: 'Address line 2 (optional)',
TOWN_OR_CITY_LABEL: 'Town or city',
POSTCODE_MANUAL_LABEL: 'Postcode',
POSTCODE_ERROR: {
'error-heading': 'Sorry, there is a problem with the postcode search',
'lookup-problem-title': 'Address lookup problem - GOV.UK'
},
NO_ADDRESS_HEADING: 'No address found',
ENTER_MANUALLY: 'Enter address manually',
ADDRESS_LOOKUP_SEARCH_TITLE: 'Postcode lookup search - GOV.UK',
ADDRESS_LOOKUP_TITLE: 'Address lookup - GOV.UK',
ADDRESS_DETAILS_TITLE: 'Address details - GOV.UK',
ADDRESS_LOOKUP_PROBLEM_TITLE: 'Address lookup problem - GOV.UK'
};
Loading
Loading