generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #218 from hlxsites/feature/anniversary-template
Created the anniversary block with sidebar
- Loading branch information
Showing
12 changed files
with
174 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* connet css */ | ||
.linkedin-bottom { | ||
padding-top: 80px; | ||
padding-bottom: 80px; | ||
} | ||
|
||
.linkedin-bottom .outer { | ||
display: block; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ const TEMPLATE_LIST = [ | |
'default', | ||
'blog', | ||
'news', | ||
'anniversary', | ||
]; | ||
|
||
const CATEGORY_LIST = [ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* Default template css */ | ||
.default-content-wrapper { | ||
text-align: left!important; | ||
} | ||
|
||
.default-content-wrapper h2:first-child { | ||
margin-top: 0px!important; | ||
} | ||
|
||
.outer { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
#main { | ||
float: none; | ||
} | ||
|
||
#sidebar { | ||
position: sticky; | ||
top: 130px; | ||
float: none; | ||
} | ||
|
||
@media (max-width: 960px) { | ||
#sidebar { | ||
top: 80px; | ||
} | ||
} | ||
|
||
@media (max-width: 860px) { | ||
.outer { | ||
flex-direction: column; | ||
} | ||
#sidebar { | ||
max-height: none; | ||
} | ||
} |
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,62 @@ | ||
function setSidebarMaxHeight() { | ||
let height = 0; | ||
const sidebar = document.querySelector('#sidebar'); | ||
[...sidebar.children].forEach((element) => { | ||
height += element.offsetHeight; | ||
}); | ||
sidebar.style.maxHeight = `${height + 50}px`; | ||
} | ||
|
||
function setSidebarHeight() { | ||
window.addEventListener('resize', setSidebarMaxHeight); | ||
window.addEventListener('click', setSidebarMaxHeight); | ||
} | ||
|
||
export default function buildAutoBlocks(block) { | ||
// const contentBlocks = block.querySelectorAll('.section'); | ||
const sidebarSections = block.querySelector('.sidebar-section'); | ||
|
||
// Creating the default template wrapper | ||
const defaultTemplate = document.createElement('div'); | ||
defaultTemplate.id = 'content-wrapper'; | ||
|
||
// Creating content wrapper | ||
const content = document.createElement('div'); | ||
content.id = 'content'; | ||
|
||
// Creating outer element | ||
const outerElement = document.createElement('div'); | ||
outerElement.className = 'outer'; | ||
|
||
// Creating main and sidebar elements | ||
const main = document.createElement('div'); | ||
main.id = 'main'; | ||
|
||
const sidebar = document.createElement('div'); | ||
sidebar.id = 'sidebar'; | ||
|
||
// Creating clearfix element | ||
const clearFix = document.createElement('div'); | ||
clearFix.className = 'clearfix'; | ||
|
||
outerElement.appendChild(main); | ||
outerElement.appendChild(sidebar); | ||
content.appendChild(outerElement); | ||
content.appendChild(clearFix); | ||
defaultTemplate.appendChild(content); | ||
// Iterate over each section | ||
if (sidebarSections.children.length > 0) { | ||
const sidebars = sidebarSections.querySelectorAll('[data-block-name^="sidebar-"]'); | ||
if (sidebars.length > 0) { | ||
sidebars.forEach((sidebarItem) => { | ||
sidebar.appendChild(sidebarItem); | ||
}); | ||
} | ||
Array.from(sidebarSections.cloneNode(true).children).forEach((child) => { | ||
main.appendChild(child); | ||
}); | ||
sidebarSections.innerHTML = defaultTemplate.outerHTML; | ||
} | ||
setTimeout(() => setSidebarMaxHeight(), 1000); | ||
setSidebarHeight(); | ||
} |
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