From 9236059935b5cad9a1fef03594cb9078e19ec1cc Mon Sep 17 00:00:00 2001 From: Bryan Stopp Date: Wed, 24 Jan 2024 12:44:47 -0600 Subject: [PATCH] Fix various style and logic issues. (#118) * Fix various style and logic issues. * Rebase error. --- cigaradvisor/blocks/article-list/article-list.js | 2 +- .../blocks/article-teaser/article-teaser.js | 5 ++++- cigaradvisor/blocks/author-detail/author-detail.css | 1 + cigaradvisor/blocks/carousel/carousel.css | 5 ++--- cigaradvisor/blocks/header/header.css | 2 ++ cigaradvisor/scripts/scripts.js | 2 +- cigaradvisor/styles/templates/blog-post.css | 13 ++++++++++++- 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/cigaradvisor/blocks/article-list/article-list.js b/cigaradvisor/blocks/article-list/article-list.js index cc070b26..abbfc6c0 100644 --- a/cigaradvisor/blocks/article-list/article-list.js +++ b/cigaradvisor/blocks/article-list/article-list.js @@ -27,7 +27,7 @@ export default async function decorate(block) { }); await Promise.all(promises).then((result) => { result.forEach((detail) => { - if (detail) tmp.push(detail); + if (detail && detail.length > 0) tmp.push(detail[0]); }); }); articles = tmp; diff --git a/cigaradvisor/blocks/article-teaser/article-teaser.js b/cigaradvisor/blocks/article-teaser/article-teaser.js index 376196cd..ca32effb 100644 --- a/cigaradvisor/blocks/article-teaser/article-teaser.js +++ b/cigaradvisor/blocks/article-teaser/article-teaser.js @@ -50,7 +50,10 @@ export default async function decorate(block) { const filterPath = block.querySelector('a')?.getAttribute('href'); let article; if (filterPath) { - article = await fetchPostsInfo(filterPath); + const list = await fetchPostsInfo(filterPath); + if (list && list.length > 0) { + [article] = list; + } } else if (block.querySelector(':scope > div > div:nth-of-type(2)').textContent.toLowerCase() === 'next') { block.classList.add('next'); const idx = document.querySelectorAll('main .article-teaser.block.next').length; diff --git a/cigaradvisor/blocks/author-detail/author-detail.css b/cigaradvisor/blocks/author-detail/author-detail.css index 8e9959a8..80065630 100644 --- a/cigaradvisor/blocks/author-detail/author-detail.css +++ b/cigaradvisor/blocks/author-detail/author-detail.css @@ -93,6 +93,7 @@ main .section.author-detail-container > div { align-items: center; margin: 0; gap: 25px; + list-style-type: none; } .author-detail.block picture.bg-image { diff --git a/cigaradvisor/blocks/carousel/carousel.css b/cigaradvisor/blocks/carousel/carousel.css index 00734b3b..131d6db9 100644 --- a/cigaradvisor/blocks/carousel/carousel.css +++ b/cigaradvisor/blocks/carousel/carousel.css @@ -1,7 +1,6 @@ .carousel-wrapper { position: relative; - padding-left: 0; - padding-right: 0; + padding: 10px 0; width: 100%; margin-left: auto; margin-right: auto; @@ -105,4 +104,4 @@ .carousel.block .slide { flex: 1 0 50%; } -} \ No newline at end of file +} diff --git a/cigaradvisor/blocks/header/header.css b/cigaradvisor/blocks/header/header.css index 92f73ee9..cb0e08ad 100644 --- a/cigaradvisor/blocks/header/header.css +++ b/cigaradvisor/blocks/header/header.css @@ -113,6 +113,7 @@ display: flex; margin: 0; padding: 0; + list-style-type: none; } .header.block nav .top-nav-right ul li { @@ -234,6 +235,7 @@ column-count: 3; width: 100%; padding: 3em; + list-style-type: none; } .header.block nav .secondary-nav-box.browse-categories ul li { diff --git a/cigaradvisor/scripts/scripts.js b/cigaradvisor/scripts/scripts.js index a691d7c4..3750b081 100644 --- a/cigaradvisor/scripts/scripts.js +++ b/cigaradvisor/scripts/scripts.js @@ -213,7 +213,7 @@ export async function fetchPostsInfo(filterValue, filterParam = 'path') { let filter = filterValue; filter = getRelativePath(filterValue); await loadPosts(); - return articleIndexData.find((obj) => obj[filterParam] === filter); + return articleIndexData.filter((obj) => obj[filterParam] === filter); } /** diff --git a/cigaradvisor/styles/templates/blog-post.css b/cigaradvisor/styles/templates/blog-post.css index 8c3a340c..d8e0356f 100644 --- a/cigaradvisor/styles/templates/blog-post.css +++ b/cigaradvisor/styles/templates/blog-post.css @@ -1,5 +1,16 @@ +/** Override global settings for hero **/ +body.blog-post-template main .articleheader-container > div { + padding: 0; + max-width: unset; +} + +body.blog-post-template main .articleheader-container > div { + max-width: unset; +} + +/** End Global overrides **/ -body.blog-post-template main main .default-content-wrapper { +body.blog-post-template main .default-content-wrapper { padding: 0 15px; width: 100%; margin-left: auto;