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

Creation of a solution block. #350

Merged
merged 4 commits into from
Oct 18, 2023
Merged
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
189 changes: 189 additions & 0 deletions blocks/solution-list/solution-list.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
main .solution-list-container {
width: 100%;
}

main .solution-list-container .solution-list-content-wrapper {
display: flex;
flex-direction: column;
align-items: flex-start;
}

.solution-list-container .default-content-wrapper p {
font-size: var(--font-size-11);
font-family: var(--sans-serif-font-medium);
line-height: var(--line-height-120); /* 16.8px */
letter-spacing: var(--letter-spacing-02-em);
text-transform: uppercase;
margin: 0;
}

.section.solution-list-container .solution-list-content-wrapper .default-content-wrapper:first-child {
padding-top: var(--spacer-element-10);
}

.solution-list-container .default-content-wrapper h2 {
margin: unset;
margin-top: var(--spacer-element-06);
width: 85%;
}

.solution-list-container .default-content-wrapper .only-picture {
display: none;
}

.solution-list-container .solution-list-wrapper .solution-list {
position: relative;
display: grid;
grid-template-columns: 1fr;
}

.solution-list-container .solution-list-wrapper .solution-list div p {
font-size: var(--font-size-16);
letter-spacing: var(--letter-spacing-001-em);
margin: var(--spacer-element-07) 0;
line-height: var(--line-height-160);
}

.solution-list-container .solution-list-wrapper .solution-list div p:first-child {
margin: unset;
}

.solution-list-container .solution-list-wrapper .solution-list div p span svg {
height: var(--spacer-layout-03);
margin-left: -40px;
}

.solution-list-container .solution-list-wrapper .solution-list div {
width: 100%;
margin: 0 auto;
padding: var(--spacer-element-10) 0;
border-bottom: 1px solid var(--neutral-sand);
}

.solution-list-container .solution-list-wrapper .solution-list div:last-child {
border-bottom: none;
padding-bottom: 0;
}

.solution-list-container .solution-list-wrapper .solution-list div h3 {
font-family: var(--sans-serif-font-medium);
font-size: var(--font-size-18);
line-height: var(--line-height-160);
letter-spacing: var(--letter-spacing-1);
margin: 0;
}

.solution-list-container .solution-list-wrapper .solution-list div .button-container {
margin: 0;
}

.solution-list-container .solution-list-wrapper .solution-list div a {
display: inline-block;
text-decoration: none;
font-family: var(--sans-serif-font-medium);
font-size: var(--font-size-16);
letter-spacing: var(--letter-spacing-1);
height: var(--spacer-element-06);
border-bottom: var(--spacer-element-01) solid var(--primary-purple);
color: var(--primary-purple);
}

.solution-list-container .solution-list-wrapper .solution-list div a:hover {
background: var(--gradient-left-right);
background-clip: text;
-webkit-background-clip: text; /* stylelint-disable-line */
-webkit-text-fill-color: transparent;
color: transparent;
border-image-slice: 1;
border-image-source: var(--gradient-left-right);
}

@media only screen and (min-width: 768px) {
main .solution-list-container .solution-list-content-wrapper {
display: flex;
flex-flow: row nowrap;
padding: var(--spacer-layout-06) 0;
align-items: flex-start;
gap: var(--gap-24);
flex-shrink: 0;
margin: 0 auto;
width: calc(100% - 72px);
}

.section.solution-list-container .solution-list-wrapper {
width: 60%;
padding-bottom: 0;
}

.solution-list-container .default-content-wrapper {
width: 40%;
}

.solution-list-container .default-content-wrapper h2 {
margin: unset;
margin-top: var(--spacer-element-07);
margin-bottom: var(--spacer-layout-05);
width: 100%;
}

.solution-list-container .default-content-wrapper .only-picture {
display: block;
}

.solution-list-container .solution-list-wrapper .solution-list div {
min-height: 200px;
}
}

@media only screen and (min-width: 1200px) {
main .solution-list-container .solution-list-content-wrapper {
width: var(--section-width-desktop);
padding: var(--spacer-layout-07) 0;
gap: var(--gap-120);
}

.solution-list-container .default-content-wrapper {
width: var(--sidebar-max-container);
}

.solution-list-container .default-content-wrapper p {
font-size: var(--font-size-14);
letter-spacing: var(--letter-spacing-02-em);
}

.solution-list-container .default-content-wrapper h2 {
margin: unset;
margin-top: var(--spacer-element-08);
margin-bottom: var(--spacer-layout-06);
}

.solution-list-container .solution-list-wrapper .solution-list {
position: relative;
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: auto auto auto;
}

.solution-list-container .solution-list-wrapper .solution-list div h3 {
font-size: var(--font-size-21);
}

.solution-list-container .solution-list-wrapper .solution-list div:nth-child(odd) > *, .solution-list-container .solution-list-wrapper .solution-list div:nth-child(odd) > p {
margin-right: 60px;
}

.solution-list-container .solution-list-wrapper .solution-list div:nth-child(even) > *, .solution-list-container .solution-list-wrapper .solution-list div:nth-child(even) > p {
margin-left: 60px;
}

/* no bottom padding for last row of cards */
.solution-list-container .solution-list-wrapper .solution-list div:nth-last-child(2), .solution-list-container .solution-list-wrapper .solution-list div:last-child {
padding-bottom: 0;
}

/* no border on last row of cards */
.solution-list-container .solution-list-wrapper .solution-list div:nth-child(2n + 1):nth-last-child(-n + 2),
.solution-list-container .solution-list-wrapper .solution-list div:nth-child(2n + 1):nth-child(2n + 1):nth-last-child(-n + 2) ~ .solution-list-container .solution-list-wrapper .solution-list div {
border-bottom: none;
}
}
26 changes: 26 additions & 0 deletions blocks/solution-list/solution-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export default async function decorate(block) {
// Remove first level of nesting
const childDivs = block.querySelectorAll('.solution-list > div');

childDivs.forEach((childDiv) => {
while (childDiv.firstChild) {
block.appendChild(childDiv.firstChild);
}
childDiv.remove();
});

// Select the solution-list-container element
const solutionListContainer = document.querySelector('.solution-list-container');

// Create a new div element
const newWrapper = document.createElement('div');
newWrapper.classList.add('solution-list-content-wrapper');

// Iterate through the existing children and move them into the new div
while (solutionListContainer.firstChild) {
newWrapper.appendChild(solutionListContainer.firstChild);
}

// Append the new div back to the solution-list-container
solutionListContainer.appendChild(newWrapper);
}