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 #220 from hlxsites/feature/landing-template
Updated the landing page code
- Loading branch information
Showing
6 changed files
with
135 additions
and
63 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
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 |
---|---|---|
|
@@ -36,6 +36,7 @@ const TEMPLATE_LIST = [ | |
'blog', | ||
'news', | ||
'anniversary', | ||
'landing-page', | ||
]; | ||
|
||
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,45 @@ | ||
.landing-section .float-left { | ||
width: 48%; | ||
float: left; | ||
} | ||
|
||
.landing-section .float-right { | ||
float: right; | ||
width: 48%; | ||
} | ||
|
||
input, select { | ||
/* -webkit-appearance: none; */ | ||
/* appearance: none; */ | ||
/* width: 100% !important; */ | ||
border-radius: 1px!important; | ||
border: 1px solid #d6dde3!important; | ||
font-family: 'Open Sans',sans-serif!important; | ||
font-size: 15px!important; | ||
font-weight: 400!important; | ||
line-height: 20px!important; | ||
color: #6a6a6a!important; | ||
padding: 10px!important; | ||
margin: 5px 0!important; | ||
} | ||
|
||
input[type="submit"] { | ||
color: var(--text-color)!important; | ||
border: 1px solid var(--primary-color)!important; | ||
} | ||
|
||
input[type="submit"]:hover { | ||
color: var(--primary-color)!important; | ||
} | ||
|
||
@media (max-width: 950px) { | ||
.landing-section .float-left { | ||
width: 100%; | ||
float: none; | ||
} | ||
|
||
.landing-section .float-right { | ||
float: none; | ||
width: 100%; | ||
} | ||
} |
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,47 @@ | ||
export default function buildAutoBlocks(block) { | ||
const landingSection = block.querySelector('.landing-section'); | ||
|
||
function createAndAppendElement(className) { | ||
const element = document.createElement('div'); | ||
element.classList.add(className); | ||
return element; | ||
} | ||
|
||
function extractAndClearFloatElements(className) { | ||
const childrenCopy = landingSection.cloneNode(true); | ||
const floatElements = [...childrenCopy.children].filter((child) => { | ||
const childElement = child.querySelector('.block'); | ||
if (childElement.classList.contains(className)) { | ||
childElement.classList.remove(className); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
return floatElements; | ||
} | ||
|
||
function appendElementsToContainer(container, elements) { | ||
elements.forEach((element) => container.appendChild(element)); | ||
} | ||
|
||
const clearFix = createAndAppendElement('clearfix'); | ||
const floatLeftBlock = createAndAppendElement('float-left'); | ||
const floatRightBlock = createAndAppendElement('float-right'); | ||
|
||
const floatLeftElements = extractAndClearFloatElements('float-left'); | ||
const floatRightElements = extractAndClearFloatElements('float-right'); | ||
|
||
// Clear the landingSection | ||
landingSection.innerHTML = ''; | ||
|
||
// Append 'float-left' elements first | ||
appendElementsToContainer(floatLeftBlock, floatLeftElements); | ||
|
||
// Append 'float-right' elements next | ||
appendElementsToContainer(floatRightBlock, floatRightElements); | ||
|
||
// Append clearFix | ||
landingSection.appendChild(floatLeftBlock); | ||
landingSection.appendChild(floatRightBlock); | ||
landingSection.appendChild(clearFix); | ||
} |