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

Feature/grid layout #36

Merged
merged 21 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a68a0e2
Merge branch 'feature/image-cta' into feature/grid-layout-section
kailasnadh790 Dec 3, 2023
c6f75fd
Update styles.css
kailasnadh790 Dec 3, 2023
4a54aae
Merge branch 'feature/articleTeaser' into feature/gridLayout
kailasnadh790 Dec 3, 2023
fcd87f7
main css
kailasnadh790 Dec 3, 2023
15e301a
Merge branch 'feature/articleTeaser' into feature/gridLayout
kailasnadh790 Dec 3, 2023
a0e3f81
styling fixes
kailasnadh790 Dec 4, 2023
5ccae45
Merge branch 'feature/articleTeaser' into feature/gridLayout
kailasnadh790 Dec 4, 2023
1be7cc5
Merge branch 'feature/articleTeaser' into feature/gridLayout
kailasnadh790 Dec 4, 2023
ea0b123
Merge branch 'main' of https://github.com/hlxsites/famous-smoke-cigar…
kailasnadh790 Dec 5, 2023
eeb19b9
Merge branch 'feature/articleTeaser' of https://github.com/hlxsites/f…
kailasnadh790 Dec 5, 2023
f05d877
Update styles.css
kailasnadh790 Dec 5, 2023
396a984
gridlayout
kailasnadh790 Dec 6, 2023
ce6ce93
Merge branch 'feature/articleTeaser' into feature/gridLayout
kailasnadh790 Dec 6, 2023
b617332
changes
kailasnadh790 Dec 6, 2023
278d383
Merge branch 'feature/articleTeaser' into feature/gridLayout
kailasnadh790 Dec 6, 2023
61e202a
changes
kailasnadh790 Dec 6, 2023
b2a23ac
working code
kailasnadh790 Dec 6, 2023
8d49370
Merge branch 'feature/articleTeaser' into feature/gridLayout
kailasnadh790 Dec 6, 2023
a577352
aligning center
kailasnadh790 Dec 6, 2023
43ccb2e
Merge branch 'main' into feature/gridLayout
kailasnadh790 Dec 6, 2023
b17e43b
refactored
kailasnadh790 Dec 6, 2023
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
24 changes: 24 additions & 0 deletions cigaradvisor/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ function buildHeroBlock(main) {
}
}

/**
* Builds two column grid.
* @param {Element} main The container element
*/
function buildTwoColumnGrid(main) {
main.querySelectorAll(':scope > .section[data-layout="50/50"]').forEach((section) => {
const leftDiv = document.createElement('div');
leftDiv.classList.add('left-grid');
const rightDiv = document.createElement('div');
rightDiv.classList.add('right-grid');
let current = leftDiv;
[...section.children].forEach((child) => {
if (child.classList.contains('separator-wrapper')) {
current = rightDiv;
child.remove();
return;
}
current.append(child);
});
section.append(leftDiv, rightDiv);
});
}

/**
* load fonts.css and set a session storage flag
*/
Expand Down Expand Up @@ -67,6 +90,7 @@ export function decorateMain(main) {
buildAutoBlocks(main);
decorateSections(main);
decorateBlocks(main);
buildTwoColumnGrid(main);
}

/**
Expand Down
52 changes: 52 additions & 0 deletions cigaradvisor/styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,55 @@ a:active, a:hover {
outline-width: 0;
}

/* Two-column grid */
main .section[data-layout="50/50"]{
padding-left: 0;
padding-right: 0;
width: 100%;
margin-left: auto;
margin-right: auto;
max-width: 1080px;
box-sizing: border-box;
display: flex;
}

@media screen and (max-width: 600px){
main .section[data-layout="50/50"]{
width: 100%;
flex-direction: column;
}
}

main .section[data-layout="50/50"] > div {
display: flex;
flex-basis: 100%;
flex-direction: column;
}

main .section[data-layout="50/50"] .left-grid > div{
padding: 10px;
}

main .section[data-layout="50/50"] .right-grid > div{
padding: 10px;
}

main .section[data-layout="50/50"] .imagecta-wrapper{
display: flex;
flex-basis: 100%;
}

main .section[data-layout="50/50"] .imagecta.block{
display: flex;
flex-basis: 100%;
}

main .section[data-layout="50/50"] .imagecta.block > a{
flex-basis: 100%;
}

@media screen and (min-width: 1200px) {
main .section[data-layout="50/50"] .imagecta.block>a img {
border: 1px solid #000;
}
}