From 971d81beeedc996ffb56c96f774b239ee3224c87 Mon Sep 17 00:00:00 2001 From: Bryan Stopp Date: Tue, 23 Jan 2024 20:11:45 -0600 Subject: [PATCH] Fix various style and logic issues. --- 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 | 4 ++-- cigaradvisor/styles/templates/blog-post.css | 13 ++++++++++++- 7 files changed, 23 insertions(+), 9 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 2d606d7d..78efdbc0 100644 --- a/cigaradvisor/blocks/article-teaser/article-teaser.js +++ b/cigaradvisor/blocks/article-teaser/article-teaser.js @@ -47,10 +47,11 @@ export function buildArticleTeaser(parentElement, article) { export default async function decorate(block) { const filterPath = block.querySelector('a').getAttribute('href'); block.classList.add('article-teaser'); - const article = await fetchPostsInfo(filterPath); - if (!article) { + const list = await fetchPostsInfo(filterPath); + if (!list || list.length === 0) { return; } + const [article] = list; block.innerHTML = ''; article.category = await fetchCategoryInfo(article.category); article.author = await fetchAuthorInfo(article.author); 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 7eb5fa4d..6d8d8243 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 { @@ -231,6 +232,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 cfc1b971..0968b923 100644 --- a/cigaradvisor/scripts/scripts.js +++ b/cigaradvisor/scripts/scripts.js @@ -198,7 +198,7 @@ let articleIndexData; * @param {string} [filterParam='path'] - The parameter to filter the posts by (default is 'path'). * @returns {Promise>} - A promise that resolves to an array of filtered post data. */ -export async function fetchPostsInfo(filterValue, filterParam = 'path') { +export async function fetchPostsInfo(filterValue, filterParam = 'raw_path') { let filter = filterValue; filter = getRelativePath(filterValue); if (!articleIndexData) { @@ -209,7 +209,7 @@ export async function fetchPostsInfo(filterValue, filterParam = 'path') { } articleIndexData = jsonData.data; } - return articleIndexData.find((obj) => obj[filterParam] === filter); + return articleIndexData.filter((obj) => obj[filterParam] === filter); } let authorIndexData; 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;