generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #91 from Netcentric/redesign-develop
Redesign develop
- Loading branch information
Showing
68 changed files
with
4,877 additions
and
591 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ helix-importer-ui | |
.DS_Store | ||
*.bak | ||
.idea | ||
|
||
.vscode/settings.json |
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 |
---|---|---|
@@ -0,0 +1,135 @@ | ||
.feature.block { | ||
position: relative; | ||
} | ||
|
||
.feature .feature-slides { | ||
display: grid; | ||
} | ||
|
||
.feature .feature-slide { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 32px; | ||
grid-area: 1 / 1 / 2 / 2; | ||
transition: opacity 500ms ease-in-out; | ||
} | ||
|
||
.feature .feature-image { | ||
margin-left: calc((100vw - 100%) / -2); | ||
margin-right: calc((100vw - 100%) / -2); | ||
} | ||
|
||
.feature .feature-image picture { | ||
display: flex; | ||
} | ||
|
||
.feature .feature-image img { | ||
width: 100%; | ||
height: auto; | ||
} | ||
|
||
.feature .feature-slides-nav { | ||
display: inline-flex; | ||
flex-direction: column; | ||
gap: 16px; | ||
position: absolute; | ||
right: 0; | ||
top: calc(75vw + 40px); | ||
margin-right: calc(var(--section-x-padding) * -1); | ||
z-index: 1; | ||
} | ||
|
||
.feature .feature-slide-nav-item { | ||
width: 42px; | ||
height: 42px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.feature-slide-nav-dot { | ||
width: 8px; | ||
height: 8px; | ||
display: block; | ||
border: solid 1px var(--grey-90); | ||
color: transparent; | ||
overflow: hidden; | ||
border-radius: 50%; | ||
} | ||
|
||
.feature .active .feature-slide-nav-dot { | ||
width: 20px; | ||
height: 20px; | ||
background: var(--black); | ||
border-radius: 50%; | ||
border-width: 0; | ||
letter-spacing: 0; | ||
} | ||
|
||
.feature .feature-text { | ||
padding-right: 36px; | ||
} | ||
|
||
.feature .feature-text .h5 { | ||
margin-bottom: 24px; | ||
} | ||
|
||
@media (width >= 768px) { | ||
.feature .feature-slide { | ||
flex-direction: row; | ||
gap: 48px; | ||
} | ||
|
||
.feature .feature-image { | ||
width: calc(50vw - 12px); | ||
margin-right: unset; | ||
} | ||
|
||
.feature .feature-text { | ||
max-width: 50%; | ||
padding-right: 67px; | ||
} | ||
|
||
.feature .feature-slides-nav { | ||
width: 42px; | ||
top: 0; | ||
margin-right: 0; | ||
z-index: 1; | ||
} | ||
|
||
.feature .feature-slide-nav-item { | ||
width: 42px; | ||
height: 42px; | ||
} | ||
|
||
.feature .feature-slide-nav-item.active span { | ||
width: 32px; | ||
height: 32px; | ||
color: var(--white); | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
} | ||
|
||
@media (width >= 1025px) { | ||
.feature .feature-slide { | ||
align-items: center; | ||
gap: 72px; | ||
} | ||
|
||
.feature .feature-text { | ||
padding-right: 80px; | ||
} | ||
|
||
.feature .feature-slides-nav { | ||
top: 50%; | ||
translate: 0 -50%; | ||
} | ||
} | ||
|
||
@media (width >= 1440px) { | ||
.feature .feature-text { | ||
padding-right: 118px; | ||
} | ||
} |
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,91 @@ | ||
import { | ||
onAppReady, | ||
} from '../../scripts/helpers.js'; | ||
|
||
const setActiveSlide = (newActiveIndex, block) => { | ||
const slides = block.querySelectorAll('.feature-slides > div'); | ||
const navItems = [...block.querySelectorAll('.feature-slide-nav-item')]; | ||
|
||
slides.forEach((slide, index) => { | ||
if (newActiveIndex === index) { | ||
slide.style.opacity = '1'; | ||
slide.style.zIndex = '1'; | ||
slide.classList.add('active'); | ||
navItems[index].classList.add('active'); | ||
} else { | ||
slide.style.opacity = '0'; | ||
slide.style.zIndex = '0'; | ||
slide.classList.remove('active'); | ||
navItems[index].classList.remove('active'); | ||
} | ||
}); | ||
}; | ||
|
||
const createNavigation = (block, slideCount, onClick) => { | ||
const slidesDots = (new Array(slideCount)) | ||
.fill(0) | ||
.map((_, index) => { | ||
const navItem = document.createElement('button'); | ||
navItem.classList.add('feature-slide-nav-item'); | ||
|
||
if (!index) { | ||
navItem.classList.add('active'); | ||
} | ||
|
||
const dotEl = document.createElement('span'); | ||
dotEl.classList.add('feature-slide-nav-dot'); | ||
dotEl.textContent = index + 1; | ||
|
||
navItem.append(dotEl); | ||
navItem.addEventListener('click', () => onClick(index, block)); | ||
|
||
return navItem; | ||
}); | ||
|
||
const wrapper = document.createElement('div'); | ||
wrapper.classList.add('feature-slides-nav'); | ||
wrapper.append(...slidesDots); | ||
block.append(wrapper); | ||
}; | ||
|
||
export default async function decorate(block) { | ||
const slideCount = block.querySelectorAll(':scope > div').length; | ||
const slideWrapper = document.createElement('div'); | ||
slideWrapper.classList.add('feature-slides'); | ||
|
||
block.querySelectorAll(':scope > div').forEach((el, index) => { | ||
if (!index) { | ||
el.replaceWith(slideWrapper); | ||
} | ||
|
||
el.classList.add('feature-slide'); | ||
slideWrapper.append(el); | ||
}); | ||
|
||
block.querySelectorAll('.feature-slides > div > div').forEach((column) => { | ||
const type = column.querySelector('picture') ? 'image' : 'text'; | ||
column.classList.add(`feature-${type}`); | ||
}); | ||
|
||
const headings = block.querySelectorAll('h1, h2, h3, h4, h5, h6'); | ||
|
||
headings.forEach((heading) => { | ||
heading.classList.add('h5'); | ||
}); | ||
|
||
createNavigation(block, slideCount, setActiveSlide); | ||
setActiveSlide(0, block); | ||
|
||
// making sure that the slide gets enought space to display slide navigation | ||
const onResize = () => { | ||
const firstTextEl = block.querySelector('.feature-text'); | ||
const navEl = block.querySelector('.feature-slides-nav'); | ||
const minHeight = window.getComputedStyle(navEl).height; | ||
|
||
firstTextEl.style.minHeight = `calc(${minHeight} + 20px)`; | ||
}; | ||
|
||
onAppReady(onResize); | ||
|
||
window.addEventListener('resize', onResize); | ||
} |
Oops, something went wrong.