Skip to content

Commit

Permalink
Added a baseUrl to state urls
Browse files Browse the repository at this point in the history
  • Loading branch information
natashapl committed Mar 23, 2024
1 parent 4fd2438 commit 2d666ab
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
1 change: 1 addition & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ module.exports = function (config) {
<use xlink:href="#svg-${name}"></use>
</svg>`;
});


// If BASEURL env variable exists, update pathPrefix to the BASEURL
if (process.env.BASEURL) {
Expand Down
27 changes: 25 additions & 2 deletions _data/assetPaths.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
{
"merriweathe": "/assets/fonts/merriweather",
"public": "/assets/fonts/public-sans",
"roboto": "/assets/fonts/roboto-mono",
"source-sans": "/assets/fonts/source-sans-pro",
"bm.svg": "/assets/img/bm-logo.svg",
"bm-small.svg": "/assets/img/bm-small-logo.svg",
"code.png": "/assets/img/codes.png",
"code.svg": "/assets/img/codes.svg",
"disaster.png": "/assets/img/disaster-info.png",
"expert.png": "/assets/img/experts.png",
"expert.svg": "/assets/img/experts.svg",
"help.svg": "/assets/img/help-icon.svg",
"her.png": "/assets/img/hero.png",
"hire.jpg": "/assets/img/hire-us.jpg",
"inspection.png": "/assets/img/inspections.png",
"inspection.svg": "/assets/img/inspections.svg",
"locatio.png": "/assets/img/location.png",
"logo.png": "/assets/img/logo-img.png",
"recover.png": "/assets/img/recovery.png",
"recover.svg": "/assets/img/recovery.svg",
"upload": "/assets/img/uploads",
"admin.js": "/assets/js/admin-C7YAUYZM.js",
"admin.map": "/assets/js/admin-C7YAUYZM.js.map",
"app.js": "/assets/js/app-DBWFVBND.js",
"app.map": "/assets/js/app-DBWFVBND.js.map",
"index.css": "/assets/styles/index-KNHDIH2P.css",
"index.map": "/assets/styles/index-KNHDIH2P.css.map"
"uswds.js": "/assets/js/uswds-init.js",
"index.css": "/assets/styles/index-HWVJ67QH.css",
"index.map": "/assets/styles/index-HWVJ67QH.css.map",
"im": "/assets/uswds/img"
}
23 changes: 11 additions & 12 deletions _includes/hero.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@ <h1 class="usa-hero__heading margin-bottom-4">
</section>

<script>
document.getElementById('stateForm').addEventListener('submit', function (event) {
event.preventDefault();
var selectedState = document.getElementById('state').value;
var baseUrl = '{{ pathPrefix }}';

// Validate the input
if (/^[A-Za-z]{2}$/.test(selectedState)) {
var encodedState = encodeURIComponent(selectedState);

window.location.href = '/states/' + encodedState + '/';
} else {
console.error('Invalid state selected');
}
});
document.getElementById('stateForm').addEventListener('submit', function(event) {
event.preventDefault();
var selectedState = document.getElementById('state').value;
if (/^[A-Za-z]{2}$/.test(selectedState)) {
var encodedState = encodeURIComponent(selectedState);
window.location.href = baseUrl + 'states/' + encodedState + '/';
} else {
console.error('Invalid state selected');
}
});
</script>
6 changes: 5 additions & 1 deletion theme/styles/_templates.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,15 @@ body {
border: 1px solid white;
background: color('green-60v');
font-weight: 400;
font-size: units(2.5);
font-size: size('body', 8);
line-height: line-height('body', 2);
padding: units(1.5) units(1.5) units(1.5) units(5);
text-align: center;
background: color('green-60v') url('../img/help-icon.svg') no-repeat units(1) center;

@include at-media(desktop) {
font-size: size('body', 5);
}
}

select,
Expand Down

0 comments on commit 2d666ab

Please sign in to comment.