Skip to content

Commit

Permalink
remove external fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
kronnox committed Jan 18, 2024
1 parent d1f1d73 commit 39bf5d7
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 224 deletions.
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

0 comments on commit 39bf5d7

Please sign in to comment.