Skip to content

Commit

Permalink
Fix various style and logic issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
bstopp committed Jan 24, 2024
1 parent 4059857 commit 971d81b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cigaradvisor/blocks/article-list/article-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions cigaradvisor/blocks/article-teaser/article-teaser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions cigaradvisor/blocks/author-detail/author-detail.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions cigaradvisor/blocks/carousel/carousel.css
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -105,4 +104,4 @@
.carousel.block .slide {
flex: 1 0 50%;
}
}
}
2 changes: 2 additions & 0 deletions cigaradvisor/blocks/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
display: flex;
margin: 0;
padding: 0;
list-style-type: none;
}

.header.block nav .top-nav-right ul li {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions cigaradvisor/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ let articleIndexData;
* @param {string} [filterParam='path'] - The parameter to filter the posts by (default is 'path').
* @returns {Promise<Array<Object>>} - 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) {
Expand All @@ -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;
Expand Down
13 changes: 12 additions & 1 deletion cigaradvisor/styles/templates/blog-post.css
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 971d81b

Please sign in to comment.