Skip to content

Commit

Permalink
#61 updates main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesKhong committed Feb 29, 2024
1 parent 6960088 commit 3c949f5
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions assets/js/main.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
// IMPORTS GO HERE
import accessibleMenu from "../../views/components/header/accessible-menu";
import navigation from "../../views/components/header/navigation";
import skipLinkFocusFix from "./components/skip-link-focus-fix";
/* IMPORTS GO HERE */
import accessibleMenu from "../../views/organisms/header/display/accessible-menu";
import mobileMenu from "../../views/organisms/header/display/mobile-menu";
import skipLinkFocusFix from "../../views/organisms/header/display/skip-link-focus-fix";

async function init () {
/* Load JS for blocks only if they exist on the page */
// https://parceljs.org/features/code-splitting/
// Accordion
const accordionsList = document.querySelector(".accordion");
if (accordionsList) {
const accordionsJS = await import('../../views/blocks/accordion/accordion');
accordionsJS.render();
}
async function init() {
/* Load JS for blocks only if they exist on the page */
/* https://parceljs.org/features/code-splitting/ */
/* Accordion */
const accordionsList = document.querySelector(".accordion");
if (accordionsList) {
const accordionsJS = await import( '../../views/organisms/blocks/accordion/display/accordion' );
accordionsJS.render();
}
/* People Cards */
const peopleCardsGrid = document.querySelector(".people-cards");
if (peopleCardsGrid) {
const peopleCardsJS = await import('../../views/organisms/blocks/people-cards/display/people-cards.js');
peopleCardsJS.render();
}
/* Video Element */
const videoElement = document.querySelector('.video-container');
if (videoElement) {
const videoJS = await import("../../views/organisms/blocks/banner/display/banner.js");
videoJS.render();
}

// Global Components
skipLinkFocusFix();
accessibleMenu();
navigation();
/* Global Components */
skipLinkFocusFix();
accessibleMenu();
mobileMenu();
}

// Initialize Site Scripts
init();
/* Initialize Site Scripts */
init();

0 comments on commit 3c949f5

Please sign in to comment.