Skip to content

Commit

Permalink
Merge pull request #220 from hlxsites/feature/landing-template
Browse files Browse the repository at this point in the history
Updated the landing page code
  • Loading branch information
pardeepgera23 authored Dec 7, 2023
2 parents abe0731 + 29e5825 commit be3f695
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 63 deletions.
10 changes: 10 additions & 0 deletions blocks/columns/columns.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
transition: all 0.3s ease 0s;
}

.cover-images picture img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover; /* Maintain aspect ratio, fitting the image within the container */
transition: all 0.3s ease 0s;
}

.zoomed-image picture img {
position: absolute;
top: 0;
Expand Down
1 change: 1 addition & 0 deletions blocks/forms/forms.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.forms {
padding: 50px 0;
min-height: 100px;
}

.forms h1, .forms h2, .forms h3, .forms h4, .forms h5, .forms h6 {
Expand Down
1 change: 1 addition & 0 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const TEMPLATE_LIST = [
'blog',
'news',
'anniversary',
'landing-page',
];

const CATEGORY_LIST = [
Expand Down
94 changes: 31 additions & 63 deletions styles/Typo.css
Original file line number Diff line number Diff line change
Expand Up @@ -553,19 +553,9 @@ fieldset {
background-color: rgba(0 0 0 / 5%);
margin: 1em 0;
padding: 1em;
}

fieldset,
legend {
border: 1px solid #fff;
}

legend {
background-color: #00ace5;
color: #fff;
margin: 0;
padding: 2px 6px;
}

optgroup {
font-weight: 700;
Expand Down Expand Up @@ -597,7 +587,7 @@ textarea {
}

select {
padding: 0.4em 0.6em;
padding: 0.6em;
}

#hs-pwd-widget-password {
Expand All @@ -616,13 +606,6 @@ input[type="text"]:focus
outline: none
}

select,select:focus,
textarea:focus {
padding: .4em .6em;
border-color: var(--primary-color);
outline: none
}

.blog-pagination a,
.button,
.cta_button,
Expand All @@ -634,18 +617,18 @@ input[type="reset"],
.hs-form input[type="submit"],
input[type="submit"] {
background-color: var(--primary-color);
border-radius: 5px;
border-radius: 5px!important;
border: 1px solid var(--primary-color);
box-sizing: border-box;
color: var(--text-color);
cursor: pointer;
display: inline-block;
font-family: Brown-Ald, Helvetica, Arial, sans-serif;
font-size: 18px;
font-size: 18px!important;
font-weight: 400;
line-height: 100%;
margin: 0;
padding: .8em 1.3em;
padding: .8em 1.3em!important;
text-align: center;
text-decoration: none;
text-transform: uppercase;
Expand Down Expand Up @@ -699,7 +682,7 @@ input[type="button"]:hover,
input[type="reset"]:hover,
input[type="submit"]:hover {
background-color: #fff;
color: var(--primary-color);
color: var(--primary-color)!important;
text-decoration: none;
border: 1px solid var(--primary-color);
}
Expand Down Expand Up @@ -1021,14 +1004,18 @@ body.mrna input[type="submit"]:hover {
}

.shadow {
padding: 10%;
padding: 0!important;
background-color: transparent;
border: none;
box-shadow: 0 2px 15px rgba(0 0 0 / 10%);
border-radius: 4px;
display: block;
}

.shadow > div {
padding: 20px!important;
}

.no-shadow {
box-shadow: none!important;
}
Expand Down Expand Up @@ -1264,6 +1251,24 @@ body.mrna input[type="submit"]:hover {
width: 100%
}

.hs-form .hs-form-checkbox {
padding:0;
margin: 0;
}

.hs-form .hs-form-checkbox input {
margin-right: 8px!important;
}

.hs-form .hs-form-radio {
padding:0;
margin: 0;
}

.hs-form .hs-form-radio input {
margin-right: 8px!important;
}

.hs-form .hsformerror {
background: #f72e00;
border: 0;
Expand Down Expand Up @@ -1728,48 +1733,11 @@ form.hs-form .hs-input[type="checkbox"] {
}

/* landing section */

.landing-section {
box-sizing: border-box;
margin: 0 auto;
width: 980px;
display: flex;
align-items: flex-start;
justify-content: center;
gap: 5px;
padding: 50px 0;
}

.landing-section > div {
flex-grow: 1;
flex-basis: 0;
padding: 0 20px;
}

.landing-section .forms {
padding: 30px;
background-color: #fff;;
border: 1px solid #cbd6e2;
}

@media (max-width: 1024px) {
.landing-section {
padding: 40px 20px;
width: auto;
flex-direction: column;
}

.landing-section > div {
padding: 0;
width: 100%;
}
}

@media (max-width: 479px) {
.landing-section {
padding: 30px 10px;
width: auto;
}
float: none !important;
max-width: 1145px !important;
margin: 0 auto !important;
}

/* sidebar-navigation css */
Expand Down
45 changes: 45 additions & 0 deletions templates/Landing-page/Landing-page.css
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%;
}
}
47 changes: 47 additions & 0 deletions templates/Landing-page/Landing-page.js
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);
}

0 comments on commit be3f695

Please sign in to comment.