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

issue-49 Changes wrt to Tags Block #56

Closed
wants to merge 3 commits into from
Closed
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
65 changes: 65 additions & 0 deletions blocks/tags/tags.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.section.tags-container {
margin-bottom: 5rem;
padding-left: 1rem;
padding-right: 1rem;
}

.section>.section-container {
border-top: 1px solid #3c465033;
padding-top: 1.75rem;
}

.section.tags-container>.section-container {
gap: 2rem;
}

.section.tags-container>.section-container:has(p) {
display: flex;
}

.section.tags-container h1 {
margin-bottom: 2rem;
font-size: 2rem;
}

.tags a.button.primary {
font-size: var(--body-font-size-xs);
font-weight: var(--font-weight-medium);
padding: 0.25rem 0.5rem;
border-radius: 10px;
height: unset;
min-width: unset;
margin-right: 0.5rem;
}

.tags a.button.primary:hover {
background-color: #00577a;
}


@media (min-width: 48rem) {
.section.tags-container.narrow {
max-width: 45rem;
margin-left: auto;
margin-right: auto;
}
}

@media (min-width: 62rem) {
.section.tags-container.narrow {
max-width: 54.5rem;
}

.section.tags-container.narrow>.section-container {
max-width: 45rem;
margin-left: 1rem;
padding-left: unset;
padding-right: unset;
}
}

@media (min-width: 77rem) {
.section.tags-container.narrow>.section-container {
margin-left: 0;
}
}
12 changes: 12 additions & 0 deletions blocks/tags/tags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* decorates the tags block
* @param {Element} block The social block element
*/
export default async function decorate(block) {
const tags = block.querySelectorAll('a');
block.innerHTML = '';

[...tags].forEach((tag) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have the tags in metadata block. Could we use them? One difference though is that you need links for them. But it looks like you can build it from the tag name itself. If not, we could keep it in a spreadsheet.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i can check that. Good point

block.appendChild(tag);
});
}
9 changes: 8 additions & 1 deletion tools/importer/import-news-press-healthythinking.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
*/
/* global WebImporter */

import { addBreadCrumb, createMetadata, fixRelativeLinks } from './utils.js';
import {
addBreadCrumb,
createMetadata,
fixRelativeLinks,
createSectionMetadata,
} from './utils.js';

/* eslint-disable no-console, class-methods-use-this */
const extractEmbed = (document) => {
Expand Down Expand Up @@ -102,6 +107,8 @@ const addTagsBlock = (document) => {
});

const table = WebImporter.DOMUtils.createTable(cells, document);
section.before(document.createElement('hr'));
section.after(createSectionMetadata({ Style: 'Narrow' }, document));
section.before(tagLabel);
section.replaceWith(table);
}
Expand Down