generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* article-nav * style update * update * Update article-navigation.js * Update scripts.js * review comments * Update author-teaser.css
- Loading branch information
1 parent
9236059
commit d1158d7
Showing
6 changed files
with
120 additions
and
6 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
cigaradvisor/blocks/article-navigation/article-navigation.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
.article-navigation.block { | ||
display: flex; | ||
flex-wrap: wrap; | ||
margin: 30px auto 0; | ||
justify-content: space-between; | ||
max-width: 1080px; | ||
align-items: stretch; | ||
} | ||
|
||
.article-navigation.block>div { | ||
padding: 10px; | ||
width: 100%; | ||
} | ||
|
||
.article-navigation.block a { | ||
background-color: var(--transparent-tan); | ||
padding: 20px 40px; | ||
border: 1px solid var(--tan); | ||
display: block; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.article-navigation.block h3 { | ||
margin: 18px 0; | ||
line-height: 35px; | ||
font-size: var(--body-font-size-l); | ||
font-weight: var(--font-weight-bold); | ||
font-family: montserrat, sans-serif; | ||
} | ||
|
||
.article-navigation.block span { | ||
line-height: 35px; | ||
font-size: var(--body-font-size-l); | ||
font-weight: var(--font-weight-bold); | ||
font-family: montserrat, sans-serif; | ||
display: inline-block; | ||
color: var(--tan); | ||
} | ||
|
||
.article-navigation.block .previous-article-nav a { | ||
text-align: center; | ||
} | ||
|
||
.article-navigation.block .next-article-nav a { | ||
text-align: center; | ||
} | ||
|
||
.article-navigation.block .previous-article-nav h3::before { | ||
content: ''; | ||
font-family: var(--ff-fontawesome); | ||
margin-right: 10px; | ||
font-size: var(--body-font-size-s); | ||
; | ||
} | ||
|
||
.article-navigation.block .next-article-nav h3::after { | ||
content: ''; | ||
font-family: var(--ff-fontawesome); | ||
margin-left: 10px; | ||
font-size: var(--body-font-size-s); | ||
} | ||
|
||
|
||
@media screen and (min-width: 600px) { | ||
.article-navigation.block>div { | ||
width: 50%; | ||
padding: 10px 10px 10px 0; | ||
} | ||
|
||
.article-navigation.block .previous-article-nav a { | ||
text-align: left; | ||
} | ||
|
||
.article-navigation.block .next-article-nav a { | ||
text-align: right; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
cigaradvisor/blocks/article-navigation/article-navigation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { loadPosts } from '../../scripts/scripts.js'; | ||
|
||
export default async function decorate(block) { | ||
const allArticles = await loadPosts(); | ||
let previousArticle; | ||
let nextArticle; | ||
const currentArticle = window.location.href; | ||
allArticles.forEach((article, index) => { | ||
if (currentArticle.indexOf(article.path) > -1) { | ||
previousArticle = allArticles[index + 1]; | ||
nextArticle = allArticles[index - 1]; | ||
} | ||
}); | ||
const previousArticleNav = document.createElement('div'); | ||
previousArticleNav.classList.add('previous-article-nav'); | ||
const nextArticleNav = document.createElement('div'); | ||
nextArticleNav.classList.add('next-article-nav'); | ||
|
||
if (previousArticle) { | ||
previousArticleNav.innerHTML = `<a href="${previousArticle.path}" rel="prev"> | ||
<h3>Previous Post</h3> | ||
<span>${previousArticle.heading}</span></a>`; | ||
} | ||
if (nextArticle) { | ||
nextArticleNav.innerHTML = `<a href="${nextArticle.path}" rel="next"> | ||
<h3>Next Post</h3> | ||
<span>${nextArticle.heading}</span></a>`; | ||
} | ||
|
||
block.replaceChildren(previousArticleNav); | ||
block.append(nextArticleNav); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters