Skip to content

Commit

Permalink
Merge pull request #514 from GSA/staging
Browse files Browse the repository at this point in the history
OGPWEB-10753
External links now displays the external link icon beside them and opens a new window
  • Loading branch information
PaulaBannerman authored Jan 8, 2025
2 parents b1e342f + 768e32a commit b83d658
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
29 changes: 29 additions & 0 deletions assets/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,33 @@

.margin-top{
margin-top: 2rem !important;
}




.external-link::after {
background-image: url('../images/icons/external-link.svg');
margin-left: 4px;
background-position: 50% 60%;
background-repeat: no-repeat;
background-size: 100%;
content: "";
display: inline;
margin-left: 5px;
padding-left: .65em;
}

#ogp-identifier.usa-identifier .external-link::after,
.usa-button.external-link::after,
.usa-nav__submenu-item .external-link::after {
background-image: url('../images/icons/launch--white.png');
margin-left: 4px;
background-position: 50% 60%;
background-repeat: no-repeat;
background-size: 100%;
content: "";
display: inline;
margin-left: 5px;
padding-left: .65em;
}
1 change: 1 addition & 0 deletions assets/images/icons/external-link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/icons/launch--white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions assets/js/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
// Add your custom javascript here
console.log("Hi from Federalist");


document.addEventListener('DOMContentLoaded', function() {
const links = document.querySelectorAll('a');
links.forEach(link => {
const url = new URL(link.href);
if (url.origin !== window.location.origin && !link.querySelector('img')) {
link.classList.add('external-link');
link.setAttribute('target', '_blank');
}
});
});

0 comments on commit b83d658

Please sign in to comment.