More responsiveness

This commit is contained in:
oitsjustjose 2020-03-05 23:06:55 -05:00
commit a922d0d9de
9 changed files with 65 additions and 90 deletions

View file

@ -10,11 +10,15 @@
display: grid;
flex-direction: row;
justify-content: center;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(384px, 1fr));
grid-auto-rows: 1fr;
grid-gap: 2rem;
grid-auto-flow: dense;
@media (max-width: 767px) {
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.card {
background-color: $cardColor;
color: $foreground;

View file

@ -453,13 +453,20 @@ button.cyan.outlined:active {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-ms-grid-columns: (minmax(300px, 1fr))[auto-fit];
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
-ms-grid-columns: (minmax(384px, 1fr))[auto-fit];
grid-template-columns: repeat(auto-fit, minmax(384px, 1fr));
grid-auto-rows: 1fr;
grid-gap: 2rem;
grid-auto-flow: dense;
}
@media (max-width: 767px) {
.cards {
-ms-grid-columns: (minmax(300px, 1fr))[auto-fit];
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
}
.cards .card {
background-color: #2a2a2a;
color: #eeeeee;

File diff suppressed because one or more lines are too long

View file

@ -453,13 +453,20 @@ button.cyan.outlined:active {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-ms-grid-columns: (minmax(300px, 1fr))[auto-fit];
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
-ms-grid-columns: (minmax(384px, 1fr))[auto-fit];
grid-template-columns: repeat(auto-fit, minmax(384px, 1fr));
grid-auto-rows: 1fr;
grid-gap: 2rem;
grid-auto-flow: dense;
}
@media (max-width: 767px) {
.cards {
-ms-grid-columns: (minmax(300px, 1fr))[auto-fit];
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
}
.cards .card {
background-color: #f3f3f3;
color: #252525;

File diff suppressed because one or more lines are too long

View file

@ -453,13 +453,20 @@ button.cyan.outlined:active {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-ms-grid-columns: (minmax(300px, 1fr))[auto-fit];
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
-ms-grid-columns: (minmax(384px, 1fr))[auto-fit];
grid-template-columns: repeat(auto-fit, minmax(384px, 1fr));
grid-auto-rows: 1fr;
grid-gap: 2rem;
grid-auto-flow: dense;
}
@media (max-width: 767px) {
.cards {
-ms-grid-columns: (minmax(300px, 1fr))[auto-fit];
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
}
.cards .card {
background-color: #26283c;
color: #ccdbf1;

File diff suppressed because one or more lines are too long

View file

@ -1,56 +1,12 @@
const dispatchModalClosed = (modal) => {
const dispatchModal = (event, modal) => {
let evt = new CustomEvent(
"modalClosed",
{
detail: {
message: modal
},
bubbles: true,
cancelable: true
}
);
document.dispatchEvent(evt);
};
const dispatchModalClosing = (modal) => {
let evt = new CustomEvent(
"modalClosing",
{
detail: {
message: modal
},
bubbles: true,
cancelable: true
}
);
document.dispatchEvent(evt);
};
const dispatchModalOpened = (modal) => {
let evt = new CustomEvent(
"modalOpened",
{
detail: {
message: modal
},
bubbles: true,
cancelable: true
}
);
document.dispatchEvent(evt);
};
const dispatchModalOpening = (modal) => {
let evt = new CustomEvent(
"modalOpening",
{
detail: {
message: modal
},
bubbles: true,
cancelable: true
}
);
event, {
detail: {
modal: modal
},
bubbles: true,
cancelable: false
});
document.dispatchEvent(evt);
};
@ -60,10 +16,10 @@ window.addEventListener("DOMContentLoaded", (evt) => {
window.onclick = (event) => {
if (event.target.classList.contains("modal")) {
let modal = event.target;
dispatchModalClosing(modal);
dispatchModal("modalClosing", modal);
modal.classList.remove("visible");
modal.removeAttribute("active");
dispatchModalClosed(modal);
dispatchModal("modalClosed", modal);
document.body.classList.remove("modal-no-scroll");
}
};
@ -72,10 +28,10 @@ window.addEventListener("DOMContentLoaded", (evt) => {
document.querySelectorAll(".modal .close").forEach((closeBtn) => {
closeBtn.addEventListener('click', (evt) => {
let modal = closeBtn.parentElement.parentElement;
dispatchModalClosing(modal);
dispatchModal("modalClosing", modal);
modal.classList.remove("visible");
modal.removeAttribute("active");
dispatchModalClosed(modal);
dispatchModal("modalClosed", modal);
document.body.classList.remove("modal-no-scroll");
});
});
@ -84,10 +40,10 @@ window.addEventListener("DOMContentLoaded", (evt) => {
document.body.addEventListener('keydown', (evt) => {
if (evt.key == "Escape") {
let modal = document.querySelector(".modal[active]");
dispatchModalClosing(modal);
dispatchModal("modalClosing", modal);
modal.classList.remove("visible");
modal.removeAttribute("active");
dispatchModalClosed(modal);
dispatchModal("modalClosed", modal);
document.body.classList.remove("modal-no-scroll");
}
});
@ -96,21 +52,17 @@ window.addEventListener("DOMContentLoaded", (evt) => {
document.querySelectorAll("[for-modal]").forEach((modalTrigerEl) => {
modalTrigerEl.addEventListener('click', (evt) => {
let modal = document.getElementById(modalTrigerEl.getAttribute("for-modal"));
dispatchModalOpening(modal);
dispatchModal("modalOpening", modal);
modal.classList.add("visible");
modal.setAttribute("active", "");
dispatchModalOpened(modal);
dispatchModal("modalOpened", modal);
document.body.classList.add("modal-no-scroll");
});
});
// Destroy embeds on modal close
document.addEventListener("modalClosed", (evt) => {
evt.detail.message.querySelectorAll("iframe").forEach((iframe) => {
evt.detail.modal.querySelectorAll("iframe").forEach((iframe) => {
const origSrc = iframe.getAttribute("src");
iframe.removeAttribute("src");
iframe.setAttribute("data-src", origSrc);
@ -120,7 +72,7 @@ window.addEventListener("DOMContentLoaded", (evt) => {
// Re-init embeds on modal open
document.addEventListener("modalOpening", (evt) => {
evt.detail.message.querySelectorAll("iframe").forEach((iframe) => {
evt.detail.modal.querySelectorAll("iframe").forEach((iframe) => {
if (iframe.hasAttribute("data-src")) {
const origSrc = iframe.getAttribute("data-src");
iframe.removeAttribute("data-src");