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

Feed and Card Block Changes #101

Merged
merged 8 commits into from
Oct 6, 2023
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
43 changes: 33 additions & 10 deletions blocks/cards/cards.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ main .block.cards {

.cards > ul {
display: flex;
justify-content: center;
list-style: none;
flex-flow: column nowrap;
padding: 0;
Expand All @@ -30,22 +29,21 @@ main .block.cards {
box-shadow: 0 2px 12px 0 rgb(60 70 80 / 20%);
border: none;
transition: all 0.15s ease-in-out;
width: 16.875rem;
padding: 12px 1rem;
margin: 0 0 1rem;
align-items: center;
text-align: left;
flex: 1;
background-color: var(--white);
}

.cards > ul > li:hover {
box-shadow: 0 4px 1rem 0 rgb(60 70 80 / 40%);
}

.cards > ul > li .date {
font-size: var(--body-font-size-xs);
color: var(--transparent-grey-color);
font-weight: var(--font-weight-medium);
padding-bottom: 0.5rem;
font-size: var(--body-font-size-xs);
sdmcraft marked this conversation as resolved.
Show resolved Hide resolved
font-weight: var(--font-weight-medium);
padding-bottom: 0.5rem;
}

.cards > ul > li > a.button {
Expand Down Expand Up @@ -77,17 +75,25 @@ main .block.cards {
}

.cards .cards-card-body {
width: calc(100% - 1rem - 3.5rem);
margin: 0 auto;
padding: 0 0 0 16px;
text-align: left;
color: var(--light-black);
padding: 10px 10px 0;
}

.cards .cards-card-body .title {
margin-bottom: 1rem;
}

.cards.large-text .cards-card-body .date {
sdmcraft marked this conversation as resolved.
Show resolved Hide resolved
font-size: var(--body-font-size-xs);
}

.cards.large-text .cards-card-body .title {
sdmcraft marked this conversation as resolved.
Show resolved Hide resolved
font-size: var(--body-font-size-m);
margin-bottom: 3rem;
}

.cards .cards-card-image img {
width: 100%;
height: 100%;
Expand Down Expand Up @@ -189,6 +195,16 @@ main .cards.machine-parts ul > li {
background: var(--transparent-blue-light-color);
}

@media screen and (min-width: 48rem) {
.cards > ul > li {
margin: 0 7px;
}

.cards > ul {
flex-flow: row nowrap;
}
}

@media screen and (min-width: 62rem) {
.section.cards-container {
margin: 5rem 0;
Expand All @@ -210,7 +226,6 @@ main .cards.machine-parts ul > li {
.cards > ul > li {
padding: 0;
text-align: center;
margin: 0 7px;
}

.cards > ul > li > a.button {
Expand Down Expand Up @@ -281,6 +296,14 @@ main .cards.machine-parts ul > li {
padding: 20px 0 0;
}

.cards.large-text .cards-card-body .date {
font-size: var(--body-font-size-s);
}

.cards.large-text .cards-card-body .title {
font-size: 20px;
jindaliiita marked this conversation as resolved.
Show resolved Hide resolved
}

.cards .cards-card-body {
font-size: 1rem;
}
Expand Down
7 changes: 7 additions & 0 deletions blocks/feed/feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ export default async function decorate(block) {
block.innerHTML = '';
const blockContents = resultParsers[blockType](results, blockCfg);
const builtBlock = buildBlock(blockType, blockContents);

[...block.classList].forEach((item) => {
if (item !== 'feed') {
builtBlock.classList.add(item);
}
});

if (block.parentNode) {
block.parentNode.replaceChild(builtBlock, block);
}
Expand Down
3 changes: 3 additions & 0 deletions blocks/social/social.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ main .section.social-container h1 + p {
main .section.social-container h4 {
color: var(--light-black);
margin-bottom: 0.5rem;
letter-spacing: 0.05rem;
font-size: var(--heading-font-size-xxs);
font-weight: var(--font-weight-bold);
}

main .section.social-container .section-container ul {
Expand Down
10 changes: 5 additions & 5 deletions blocks/social/social.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export default async function decorate(block) {
firstP.replaceWith(innerSpan);
}

const firstH6 = socialContainer?.querySelector('h6');
const firstH4 = socialContainer?.querySelector('h4');

if (firstH6?.nextElementSibling?.tagName === 'H1') {
const { textContent } = firstH6;
if (firstH4?.nextElementSibling?.tagName === 'H1') {
const { textContent } = firstH4;
const placeholders = await fetchPlaceholders(getLanguage());
const newMap = {};
Object.keys(placeholders).forEach((entry) => {
Expand All @@ -67,8 +67,8 @@ export default async function decorate(block) {
const a = document.createElement('a');
a.href = val;
a.textContent = textContent;
firstH6.innerHTML = '';
firstH6.appendChild(a);
firstH4.innerHTML = '';
firstH4.appendChild(a);
}

decorateAnchors(block);
Expand Down
6 changes: 3 additions & 3 deletions tools/importer/import-news-press-healthythinking.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const createFragmentBlockFromSection = (document) => {
if (section) {
const table = WebImporter.DOMUtils.createTable(block, document);
section.before(document.createElement('hr'));
section.before(document.querySelector('.slider-title'));
section.after(document.createElement('hr'));
section.replaceWith(table);
}
Expand Down Expand Up @@ -160,9 +159,10 @@ const removeRedundantTag = (document) => {

const initialH6 = document.querySelector('h6.rabel');
if (initialH6) {
const h4 = document.createElement('h4');
const textContent = initialH6.querySelector('a')?.textContent;
initialH6.innerHTML = '';
initialH6.textContent = textContent;
h4.textContent = textContent;
initialH6.replaceWith(h4);
}
};

Expand Down