From d0ca85c92c27768e766508d36400d32caadcee05 Mon Sep 17 00:00:00 2001 From: Kailas Nadh U <53608019+kailasnadh790@users.noreply.github.com> Date: Thu, 18 Jan 2024 11:53:15 -0500 Subject: [PATCH] Feature/404 (#79) * hero * initial commit * errorpage * Update hero.js * Revert "Update hero.js" This reverts commit 5cd8a8578f2788bfe81927138d5f894a3af8d688. * Revert "hero" This reverts commit 5e3525ecacd524d5e1637f34927fdbb09fc113c7. --------- Co-authored-by: Bryan Stopp --- 404.html | 7 +++++-- cigaradvisor/scripts/scripts.js | 30 +++++++++++++++++++++++++++ cigaradvisor/styles/styles.css | 36 +++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/404.html b/404.html index dd97e470..020d9990 100644 --- a/404.html +++ b/404.html @@ -9,11 +9,12 @@ - + diff --git a/cigaradvisor/scripts/scripts.js b/cigaradvisor/scripts/scripts.js index 7ebcf2d7..4a0a16ce 100644 --- a/cigaradvisor/scripts/scripts.js +++ b/cigaradvisor/scripts/scripts.js @@ -95,6 +95,35 @@ function buildArticleHeader(mainEl) { mainEl.prepend(div); } +/** + * Builds three column grid. + * @param {Element} main The container element + */ +function buildThreeColumnGrid(main) { + main.querySelectorAll(':scope > .section[data-layout="3-column"]').forEach((section) => { + const leftDiv = document.createElement('div'); + leftDiv.classList.add('left-grid'); + const centerDiv = document.createElement('div'); + centerDiv.classList.add('center-grid'); + const rightDiv = document.createElement('div'); + rightDiv.classList.add('right-grid'); + let current = leftDiv; + [...section.children].forEach((child) => { + if (child.classList.contains('separator-wrapper')) { + if (current === centerDiv) { + current = rightDiv; + } else { + current = centerDiv; + } + child.remove(); + return; + } + current.append(child); + }); + section.append(leftDiv, centerDiv, rightDiv); + }); +} + /** * Builds two column grid. * @param {Element} main The container element @@ -157,6 +186,7 @@ export function decorateMain(main) { decorateSections(main); decorateBlocks(main); buildTwoColumnGrid(main); + buildThreeColumnGrid(main); } /** diff --git a/cigaradvisor/styles/styles.css b/cigaradvisor/styles/styles.css index 5a18f639..d9695a24 100644 --- a/cigaradvisor/styles/styles.css +++ b/cigaradvisor/styles/styles.css @@ -333,6 +333,42 @@ main .section[data-layout="50/50"] .right-grid > div { padding: 10px; } +/* Three-column grid */ +main .section[data-layout="3-column"] { + padding-left: 0; + padding-right: 0; + width: 100%; + margin-left: auto; + margin-right: auto; + max-width: 1080px; + box-sizing: border-box; + display: flex; +} + +main .section[data-layout="3-column"] ul { + list-style-type: disc; +} + +/* stylelint-disable-next-line no-descending-specificity */ +main .section[data-layout="3-column"] > div { + display: flex; + flex: 1; + flex-direction: column; +} + +main .section[data-layout="3-column"] > .left-grid { + flex: 0 0 25%; +} + +main .section[data-layout="3-column"] > .center-grid, main .section[data-layout="3-column"] > .right-grid { + flex: 0 0 37.5%; +} + +/* stylelint-disable-next-line no-descending-specificity */ +main .section[data-layout="3-column"] * > div { + padding: 2px; +} + .icon > img { width: var(--icon-size); height: var(--icon-size);