Skip to content

Commit

Permalink
Config prettier and eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
mahoneycm committed Jul 29, 2023
1 parent 24e3277 commit 2680719
Show file tree
Hide file tree
Showing 6 changed files with 2,656 additions and 231 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": ["airbnb-base"],
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"quotes": ["error", "double"]
}
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_site
index.js
bundle.css
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
16 changes: 6 additions & 10 deletions js/_nav.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/* eslint-disable no-unused-expressions */
const HEADER = document.querySelector(".header");
const HERO = document.querySelector(".hero");
const MENU_BUTTON = document.querySelector(".header__menu-btn");
const NAV = document.querySelector(".header__nav");
const OVERLAY = document.querySelector(".overlay");
const STICKY = "header--sticky";
const CAROUSEL_WRAPPER = document.querySelector(".gallery__carousel-wrapper");

let navOpen = false;

MENU_BUTTON.addEventListener("click", function () {
MENU_BUTTON.addEventListener("click", () => {
MENU_BUTTON.classList.toggle("hidden");
NAV.classList.toggle("opened");
OVERLAY.classList.toggle("hidden");

// Remove backdrop filter from image carousel to fix nav stacking bug
CAROUSEL.style.backdropFilter = "none";
navOpen = !navOpen;
});

Expand All @@ -23,15 +21,12 @@ function closeNav() {
MENU_BUTTON.classList.remove("hidden");
OVERLAY.classList.add("hidden");

// Return backdrop filter to image carousel
CAROUSEL_WRAPPER.style.backdropFilter = "blur(3rem)";

navOpen = false;
}

OVERLAY.addEventListener("click", closeNav);

window.onscroll = function (e) {
window.onscroll = () => {
if (navOpen) {
closeNav();
}
Expand All @@ -46,7 +41,8 @@ function listHover(o) {
.querySelectorAll(".header__nav-link");

siblings.forEach((el) => {
if (el !== link) el.style.opacity = o;
const sibling = el;
if (sibling !== link) sibling.style.opacity = o;
});
}
};
Expand All @@ -55,7 +51,7 @@ function listHover(o) {
NAV.addEventListener("mouseover", listHover(0.5));
NAV.addEventListener("mouseout", listHover(1));

function stickyHeader(entries, observer) {
function stickyHeader(entries) {
entries.forEach((entry) => {
entry.isIntersecting
? HEADER.classList.remove(STICKY)
Expand Down
Loading

0 comments on commit 2680719

Please sign in to comment.