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

Homepage hero #54

Merged
merged 34 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fd68735
initial
kailasnadh790 Dec 20, 2023
8f174f3
Merge branch 'main' into feature/header
kailasnadh790 Dec 30, 2023
510b07d
header
kailasnadh790 Jan 1, 2024
c36ffa2
progress
kailasnadh790 Jan 2, 2024
5b6ce00
fixing gap between primary nav and top-nav
kailasnadh790 Jan 2, 2024
2ffe6cc
desktop
kailasnadh790 Jan 2, 2024
4d71e99
Update header.js
kailasnadh790 Jan 3, 2024
a73f41d
Secondary nav toggle
kailasnadh790 Jan 3, 2024
4961020
desktop complete
kailasnadh790 Jan 3, 2024
5ae7840
mobile initial
kailasnadh790 Jan 4, 2024
cbb2e24
mobile complete
kailasnadh790 Jan 4, 2024
c6808ab
social icons
kailasnadh790 Jan 4, 2024
d212dce
impl
kailasnadh790 Jan 5, 2024
a98250a
desktop refractor
kailasnadh790 Jan 5, 2024
b8c8d5c
mobile
kailasnadh790 Jan 5, 2024
561efc6
refactor
kailasnadh790 Jan 5, 2024
3458ed2
Update header.js
kailasnadh790 Jan 5, 2024
06060df
linting
kailasnadh790 Jan 5, 2024
6670bce
deleting unwanted files
kailasnadh790 Jan 5, 2024
a6287a8
Update header.css
kailasnadh790 Jan 5, 2024
68a58e0
refractor
kailasnadh790 Jan 5, 2024
09b9a22
variable declarations
kailasnadh790 Jan 5, 2024
03994aa
Update styles.css
kailasnadh790 Jan 5, 2024
de40f3e
decorateExternalLink
kailasnadh790 Jan 5, 2024
30a56a2
hero-initial
kailasnadh790 Jan 8, 2024
a6b55d7
Update header.css
kailasnadh790 Jan 8, 2024
2d681fa
Merge branch 'feature/header' into feature/hero
kailasnadh790 Jan 8, 2024
00b4695
progress
kailasnadh790 Jan 9, 2024
dcc9cd5
Merge branch 'main' into feature/hero
kailasnadh790 Jan 9, 2024
8266169
progress
kailasnadh790 Jan 9, 2024
5e6acbd
z-index issue on input field
kailasnadh790 Jan 9, 2024
6ffbd95
fixes
kailasnadh790 Jan 9, 2024
57bf0df
home hero
kailasnadh790 Jan 10, 2024
712c14b
color vars
kailasnadh790 Jan 10, 2024
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
6 changes: 5 additions & 1 deletion cigaradvisor/blocks/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@
z-index: 1000;
}

.header.block .mobile-nav.mobile-nav-closed{
z-index: 1;
}

.header.block .mobile-nav .mobile-primary-nav-wrapper {
background-color: var(--clr-white);
width: 100%;
Expand Down Expand Up @@ -460,7 +464,7 @@
padding: 20px 0 5px;
}

.header.block .mobile-nav .mobile-primary-nav .nav-hamburger, .search{
.header.block .mobile-nav .mobile-primary-nav .nav-hamburger,.header.block .mobile-nav .mobile-primary-nav .search{
width: 1.25em;
height: 1.25em;
font-size: 2em;
Expand Down
8 changes: 8 additions & 0 deletions cigaradvisor/blocks/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,17 @@ export default async function decorate(block) {
mobilePrimaryNavWrapper.append(mobilePrimaryNavContent);
mobilePrimaryNavWrapper.append(socialNavMobile);
mobileNav.append(mobilePrimaryNavWrapper);
mobileNav.classList.add('mobile-nav-closed');

hamburger.addEventListener('click', () => {
mobilePrimaryNavWrapper.classList.toggle('nav-content-open');
if (mobileNav.classList.contains('mobile-nav-closed')) {
mobileNav.classList.remove('mobile-nav-closed');
} else {
setTimeout(() => {
mobileNav.classList.add('mobile-nav-closed');
}, 500);
}
});

const lastChild = primaryNav.querySelector('li:last-child');
Expand Down
130 changes: 122 additions & 8 deletions cigaradvisor/blocks/hero/hero.css
Original file line number Diff line number Diff line change
@@ -1,27 +1,41 @@
/* block specific CSS goes here */

main .hero-container > div {
main .hero-container>div {
max-width: unset;
}

main .hero-container {
padding: 0;
margin-bottom: 10%;
}
main .hero {

main .hero.block {
position: relative;
padding: 32px;
min-height: 300px;
text-align: center;
line-height: 1;
letter-spacing: 3px;
color: var(--off-white);
text-shadow: 3px 3px var(--clr-black);
text-wrap: nowrap;
}

main .hero.block>div>div {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}

main .hero h1 {
main .hero.block h1 {
max-width: 1200px;
margin-left: auto;
margin-right: auto;
color: white;
}

main .hero picture {
main .hero.block picture {
position: absolute;
z-index: -1;
top: 0;
Expand All @@ -32,8 +46,108 @@ main .hero picture {
box-sizing: border-box;
}

main .hero img {
main .hero.block img {
object-fit: cover;
margin-top: 1%;
height: 85%;
}

main .hero.block .hero-content {
position: absolute;
top: 25%;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-flow: column;
justify-content: center;
align-items: center;
padding: 0 1rem;
color: var(--clr-white);
text-shadow: 0 0 1rem var(--clr-black);
}

/* hero search */
main .hero.block .hero-search .search-box{
display: flex;
justify-content: center;
}

main .hero.block .hero-search{
margin: 20px auto;
width: 100%;
height: 100%;
}

main .hero.block .search{
width: 70%;
}

main .hero.block .search form {
border-bottom: 4px solid var(--clr-dark-gray);
padding-bottom: 10px;
}

main .hero.block .search form .focused{
transition: 1s;
background-color: var(--light-grey);
}

main .hero.block .search form button {
position: relative;
top: 0;
right: 0;
background: 0 0;
color: var(--clr-dark-gray);
width: 2.85rem;
padding: 0;
line-height: 2.85rem;
margin: 0;
border: none;
border-radius: 0;
}

/* set form input placeholder text color color: var(--clr-dark-gray); */
main .hero.block .search form input {
color: var(--clr-dark-gray);
border: none;
font-weight: 700;
font-size: 18px;
text-transform: capitalize;
width: 100%;
background: 0 0;
position: relative;
left: 0;
max-width: 100%;
z-index: 1;
}

main .hero.block .search form input::placeholder {
color: var(--clr-dark-gray);
}

main .hero.block .search form button::before {
position: relative;
width: 2em;
font-size: 30px;
content: "\f002";
text-align: center;
font-family: var(--ff-fontawesome);
cursor: pointer;
}

@media screen and (min-width: 900px) {
main .hero.block img {
width: 100%;
height: 185%;
max-width: none;
margin-top: -65px;
}

main .hero.block .search{
width: 30%;
}

main .hero.block .hero-content {
top: 100%;
}
}
37 changes: 35 additions & 2 deletions cigaradvisor/scripts/scripts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
sampleRUM,
buildBlock,
loadHeader,
loadFooter,
decorateButtons,
Expand All @@ -18,6 +19,39 @@ const LCP_BLOCKS = []; // add your LCP blocks to the list
* Builds hero block and prepends to main in a new section.
* @param {Element} main The container element
*/
function buildHeroBlock(main) {
const h1 = main.querySelector('h1');
const picture = main.querySelector('picture');
// eslint-disable-next-line no-bitwise
if (h1 && picture && (h1.compareDocumentPosition(picture) & Node.DOCUMENT_POSITION_PRECEDING)) {
const section = document.createElement('div');
section.classList.add('section--hero');
const heroContent = document.createElement('div');
heroContent.classList.add('hero-content');
const search = document.createElement('div');
search.classList.add('search');
search.innerHTML = `<form action="/cigaradvisor/" class="hero-search" method="get">
<label class="sr-only" for="main-search-term">Search</label>
<div class="search-box">
<input type="search" class="search__input predictiveSearch" id="main-search-term" maxlength="255" placeholder="SEARCH" name="s" data-url="GetSearchSuggestions" autocomplete="off" value="">
<button type="submit" class="search__submit" value="Submit" title="Submit"></button>
</div>
</form>`;
heroContent.append(h1);
heroContent.append(search);
section.append(buildBlock('hero', { elems: [picture, heroContent] }));
main.prepend(section);
// on-focus of input, add class to form
const searchInput = main.querySelector('.hero-search input');
searchInput.addEventListener('focus', () => {
searchInput.parentNode.classList.add('focused');
});
// on-blur of input, remove class from form
searchInput.addEventListener('blur', () => {
searchInput.parentNode.classList.remove('focused');
});
}
}

/**
* Builds two column grid.
Expand Down Expand Up @@ -58,10 +92,9 @@ async function loadFonts() {
* Builds all synthetic blocks in a container element.
* @param {Element} main The container element
*/
// eslint-disable-next-line no-unused-vars
function buildAutoBlocks(main) {
try {
// do nothing
buildHeroBlock(main);
} catch (error) {
// eslint-disable-next-line no-console
console.error('Auto Blocking failed', error);
Expand Down
37 changes: 30 additions & 7 deletions cigaradvisor/styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
--grey: #333;
--light-grey: #d3d3d3;
--dark-grey: #3c3a3b;
--off-white: #f7f7f7;

/* functional-colors */
--clr-text: var(--clr-dark-gray);
Expand Down Expand Up @@ -224,6 +225,16 @@ img {
border-style: none;
}

h1 {
font-size: 25px;
font-family: var(--ff-alfaslabone);
font-style: normal;
font-weight: 400;
text-transform: uppercase;
color: #141414;
margin: 2px auto;
}

h2 {
font-family: var(--ff-montserrat);
font-weight: 900;
Expand Down Expand Up @@ -321,13 +332,6 @@ main .section[data-layout="50/50"] {
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%;
Expand Down Expand Up @@ -356,3 +360,22 @@ main .section[data-layout="50/50"] .right-grid>div {
.bg-pampas {
background-color: var(--clr-pampas);
}

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

@media screen and (min-width: 600px) {
h1 {
font-size: 35px;
}
}

@media screen and (min-width: 900px) {
h1 {
font-size: 45px;
}
}