Skip to content

Commit

Permalink
Merge branch 'main' into feature/404
Browse files Browse the repository at this point in the history
  • Loading branch information
bstopp authored Jan 18, 2024
2 parents 9aa7afb + d52672a commit 077f6e3
Show file tree
Hide file tree
Showing 17 changed files with 165 additions and 257 deletions.
16 changes: 9 additions & 7 deletions cigaradvisor/blocks/article-teaser/article-teaser.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
display: flex;
align-items: flex-start;
flex: 1 0 13rem;
width: 100%;
width: 100%;
}

.article-teaser.block .article.article-thumbnail .article-image>img {
Expand Down Expand Up @@ -238,12 +238,14 @@
}

.article-teaser.block .read-more::after {
content: '\f054';
font-family: FontAwesome, sans-serif;
display: inline-block;
width: 12px;
height: 12px;
content: url('/cigaradvisor/icons/angle-right.svg');
margin-left: 8px;
line-height: 1.5;
color: #b19b5e;
font-size: 18px;
vertical-align: top;
margin-top: 2px;
filter: var(--clr-filter-subdued-gold);
}

.article-teaser.block .article-thumbnail .article-read-more {
Expand Down Expand Up @@ -296,4 +298,4 @@
.article-teaser.block .article.article-thumbnail {
min-height: 26.25rem;
}
}
}
31 changes: 4 additions & 27 deletions cigaradvisor/blocks/author/author.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,37 +83,14 @@
.author.block .author-details ul {
display: flex;
margin: 10px 0;

--icon-size: 20px;
}

.author.block .author-details ul li {
margin-right: 20px;
}

.author.block .author-details ul li a::before {
font-family: var(--ff-fontawesome);
font-style: normal;
font-weight: bolder;
text-decoration: inherit;
font-size: 20px;
color: #141414
}

.author.block .author-details ul li.social-twitter a::before {
content: "\f099";
}

.author.block .author-details ul li.social-facebook a::before {
content: "\f39e";
}

.author.block .author-details ul li.social-instagram a::before {
content: "\f16d";
}

.author.block .author-details ul li.social-youtube a::before {
content: "\f167";
}

/* media queries */
@media screen and (min-width: 900px) {
.author.block>div {
Expand Down Expand Up @@ -153,6 +130,6 @@
.author.block .author-details .author-heading {
display: flex;
flex-direction: row;
align-items: left;
align-items: start;
}
}
}
39 changes: 29 additions & 10 deletions cigaradvisor/blocks/author/author.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { decorateExternalLink } from '../../scripts/scripts.js';
import { decorateIcons } from '../../scripts/aem.js';

/**
* Loads an author.
Expand Down Expand Up @@ -51,20 +52,38 @@ export default async function decorate(block) {
if (authorPContent) {
authorDetails.append(authorPContent);
}
const socilaLinks = author.querySelector('ul');
if (socilaLinks) {
const socialItems = socilaLinks.querySelectorAll('li');
const socialLinks = author.querySelector('ul');
if (socialLinks) {
const socialItems = socialLinks.querySelectorAll('li > a');
socialItems.forEach((item) => {
const textNode = item.childNodes[0];
if (textNode && textNode.textContent !== '') {
const text = `social-${textNode.textContent.trim()}`;
textNode.innerText = '';
const textToClass = text.toLowerCase().replace(/\s/g, '-');
item.className = textToClass;
const innerText = item.innerText.trim();
if (innerText && innerText !== '') {
let icon;
switch (innerText) {
case 'twitter':
icon = 'twitter';
break;
case 'facebook':
icon = 'facebook-f';
break;
case 'instagram':
icon = 'instagram';
break;
case 'youtube':
icon = 'youtube';
break;
case 'pintrest':
icon = 'pintrest-p';
break;
default:
icon = 'unknown';
}
item.innerHTML = `<span class="icon icon-${icon}"></span>`;
}
});

authorDetails.append(socilaLinks);
decorateIcons(socialLinks);
authorDetails.append(socialLinks);
} else {
const emptySocialLinks = document.createElement('ul');
authorDetails.append(emptySocialLinks);
Expand Down
29 changes: 17 additions & 12 deletions cigaradvisor/blocks/footer/footer.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
font-family: var(--ff-montserrat);
}

.footer > h2 {
display: none;
}

.footer a {
line-height: unset;
font-size: unset;
Expand All @@ -28,6 +32,7 @@

.footer-legal ul > li {
line-height: 18px;
color: inherit;
}

.footer-legal a {
Expand All @@ -38,18 +43,18 @@
padding: 18px 0 40px;
}

.footer-nav > .nav-container {
.footer-nav nav {
display: grid;
}

.footer-nav > .nav-container > .nav-section {
.footer-nav nav > .nav-section {
padding: 10px;
width: 100%;
font-size: 14px;
line-height: 33px;
}

.footer-nav > .nav-container > .nav-section.with-heading > h1 {
.footer-nav nav > .nav-section.with-heading > h1 {
margin-bottom: 5px;
color: #673841;
font-family: var(--ff-opensans);
Expand All @@ -58,17 +63,17 @@
letter-spacing: .06em;
}

.footer-nav > .nav-container > .nav-section > ul {
.footer-nav nav > .nav-section > ul {
list-style-type: none;
padding: 0;
margin: 0;
}

.footer-nav > .nav-container > .nav-section:last-child > ul > li {
.footer-nav nav > .nav-section:last-child > ul > li {
display: inline;
}

.footer-nav > .nav-container > .nav-section:last-child > ul > li .icon {
.footer-nav nav > .nav-section:last-child > ul > li .icon {
--icon-size: 28px;

margin: 0 10px;
Expand All @@ -84,18 +89,18 @@
padding-bottom: 40px;
}

.footer-nav > .nav-container {
.footer-nav nav {
max-width: 1100px;
margin: auto;
grid-template-columns: repeat(4, 1fr);
grid-template-areas: "nav nav nav nav" "social social social social";
}

.footer-nav > .nav-container > .nav-section {
.footer-nav nav > .nav-section {
width: fit-content;
}

.footer-nav > .nav-container > .nav-section:last-child {
.footer-nav nav > .nav-section:last-child {
grid-area: social;
margin: auto;
text-align: center;
Expand All @@ -113,17 +118,17 @@
}

@media screen and (min-width: 960px) {
.footer-nav > .nav-container {
.footer-nav nav {
grid-template-columns: 8% 18% 18% 18% auto;
}

.footer-nav > .nav-container > .nav-section:last-child {
.footer-nav nav > .nav-section:last-child {
grid-area: unset;
margin: unset;
text-align: unset;
}

.footer-nav > .nav-container > .nav-section:last-child > ul > li .icon {
.footer-nav nav > .nav-section:last-child > ul > li .icon {
margin: 0 18px;
}
}
Expand Down
19 changes: 11 additions & 8 deletions cigaradvisor/blocks/footer/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ export default async function decorate(block) {
footerContent.innerHTML = footerContent.innerHTML.replaceAll('{year}', currentYear.toString());

// decorate footer sections
const footerContainer = footerContent.querySelector('div.footer-nav > .default-content-wrapper');
if (footerContainer && footerContainer.childNodes.length) {
footerContainer.classList.add('nav-container');

let currentElement = footerContainer.firstElementChild;
const footerNavContainer = footerContent.querySelector('div.footer-nav > .default-content-wrapper');
const footerNav = document.createElement('nav');
if (footerNavContainer && footerNavContainer.childNodes.length) {
let currentElement = footerNavContainer.firstElementChild;
let nextElement;
while (currentElement) {
// create section
const section = document.createElement('div');
section.classList.add('nav-section');
if (currentElement.tagName === 'h4') {
if (currentElement.tagName === 'H3') {
section.classList.add('with-heading');
}

Expand All @@ -34,12 +33,16 @@ export default async function decorate(block) {
nextElement = currentElement.nextSibling;
section.appendChild(currentElement);
currentElement = nextElement;
} while (nextElement && nextElement.tagName !== 'h4');
} while (nextElement && nextElement.tagName !== 'H3');

// add section to container
footerContainer.insertBefore(section, currentElement);
footerNav.append(section);
}
footerNavContainer.append(footerNav);
}

block.innerHTML = footerContent.innerHTML;
const footerHeading = document.createElement('H2');
footerHeading.innerText = 'Footer';
block.prepend(footerHeading);
}
Loading

0 comments on commit 077f6e3

Please sign in to comment.