-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: language switching and handling cta buttons and their ensui…
…ng behaviours (incl the modal/dialog) are now js modules. fixes #23 language switching should be reusable across all pages. we now detect, in main.js, whether we are on the homepage or not. if not, then we do not attach event listeners to elements (the cta buttons) that don't actually exists. thereby avoiding console errors that appear on those policy pages, which fixes #23
- Loading branch information
1 parent
3906f4d
commit 6778261
Showing
6 changed files
with
46 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const signupDialog = document.querySelector("dialog"); | ||
const joinButton = document.querySelector("#join-waitlist"); | ||
const emailButton = document.querySelector("#email"); | ||
|
||
const closeDialog = (e) => { | ||
if (e.target === signupDialog) signupDialog.close(); | ||
}; | ||
|
||
const sendEmail = () => { | ||
const EMAIL_ADDRESS = "admin@intellex.academy"; | ||
const emailLink = `mailto:${EMAIL_ADDRESS}?subject=Pre-registration Enquiry`; | ||
|
||
window.location.href = emailLink; | ||
}; | ||
|
||
const enableCTAs = () => { | ||
joinButton.addEventListener("click", () => signupDialog.showModal()); | ||
signupDialog.addEventListener("click", closeDialog); | ||
emailButton.addEventListener("click", sendEmail); | ||
}; | ||
|
||
export default enableCTAs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import enableLanguageSwitch from "./enableLanguageSwitch.mjs"; | ||
import enableCTAs from "./enableCTAs.mjs"; | ||
|
||
const isHomepage = () => window.location.pathname === "/"; | ||
|
||
if (isHomepage()) enableCTAs(); | ||
|
||
enableLanguageSwitch(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters