Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove external fonts and replace font-awesome characters with icons #80

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading