Skip to content

Commit

Permalink
Merge pull request #8 from WWWPiramalFinanceCOM/feature/homepage-bugf…
Browse files Browse the repository at this point in the history
…ixes

Feature/homepage bugfixes
  • Loading branch information
VaibhavSasulkar authored Jul 4, 2024
2 parents 3701706 + 67d700e commit a9b4961
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
1 change: 1 addition & 0 deletions blocks/carousel/carousel.css
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
position: absolute;
left: 160px;
bottom: 60px;
gap: 8px;
}

.section.banner-carousel-wrapper .carousel-wrapper .carousel.block .button-container>button {
Expand Down
22 changes: 14 additions & 8 deletions blocks/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -375,17 +375,17 @@ header nav .nav-sections .nav-drop::after{
.header-wrapper .nav-wrapper nav .nav-sections .default-content-wrapper>ul>li>ul {
width: 100%;
left: 0;
padding: 0 8.7%;
padding: 0 11%;
background-color: rgb(239 239 239);
position: absolute;
top: 100%;
margin-top: 0;
}

.header-wrapper .nav-wrapper nav .nav-sections .default-content-wrapper>ul>li>ul>li {
width: 25%;
/* width: 25%;
display: flex;
flex-wrap: wrap;
flex-wrap: wrap; */
padding-left: 8px;
padding-right: 8px;
height: max-content;
Expand Down Expand Up @@ -423,11 +423,17 @@ header nav .nav-sections .nav-drop::after{
}

.header-wrapper .nav-wrapper nav .nav-sections .default-content-wrapper>ul>li[aria-expanded="true"]>ul {
display: flex;
/* display: flex;
flex-wrap: wrap;
gap: unset;
gap: unset; */
padding-top: 1rem;
padding-bottom: 1rem;
column-gap: 20px;
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
margin: 0 auto;
max-width: 100%;
row-gap: 20px;
}

.header-wrapper .nav-wrapper nav .nav-sections .default-content-wrapper>ul>li.nav-drop>p {
Expand Down Expand Up @@ -550,9 +556,9 @@ header nav .nav-sections .nav-drop::after{
display: none;
}

.header-wrapper .nav-wrapper nav .nav-sections .default-content-wrapper>ul>li:last-child ul>li {
/* .header-wrapper .nav-wrapper nav .nav-sections .default-content-wrapper>ul>li:last-child ul>li {
width: 12%;
}
} */

header nav .nav-sections .default-content-wrapper > ul > li > ul::before {
content: none;
Expand Down Expand Up @@ -611,7 +617,7 @@ header nav .nav-sections .default-content-wrapper > ul > li > ul::before {
.header-wrapper .nav-wrapper nav .nav-sections .default-content-wrapper > ul > li:nth-child(6) > ul > li:nth-child(1) > ul>li:nth-child(5)::after {
content: "New";
position: absolute;
right: 30%;
right: 25%;
background-color: #41c66e;
border-radius: 4px;
color: #fff;
Expand Down
13 changes: 7 additions & 6 deletions blocks/teaser/teaser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { targetObject } from "../../scripts/scripts.js";

export function decorateButtons(...buttons) {
return buttons
.map((div) => {
Expand Down Expand Up @@ -41,7 +43,7 @@ export function generateTeaserDOM(props, classes) {
ctaImageUrl3,
mobileImage,
] = props;

const bgPicture = pictureBgContainer.querySelector("picture");
const picture = pictureContainer.querySelector("picture");
const hasShortDescr = shortDescr.textContent.trim() !== "";
Expand All @@ -55,13 +57,12 @@ export function generateTeaserDOM(props, classes) {
const bgPictureStyle = bgPicture?.querySelector('img')?.src || "";
const mobileImageStyle = mobileImage?.querySelector('img')?.src || "";
let bgImageAllow = bgPictureStyle;
const isMobile = window.matchMedia('(max-width: 768px)');
if(isMobile){
bgImageAllow = mobileImageStyle;
if (targetObject.isMobile) {
bgImageAllow = mobileImageStyle;
}

const teaserDOM = document.createRange().createContextualFragment(
`
`
<div class='background' style='background-image:url(${bgImageAllow})'>
<div class="front-picture">${picture ? picture.outerHTML : ""}</div>
<div class='foreground'>
Expand All @@ -80,7 +81,7 @@ export function generateTeaserDOM(props, classes) {
<div class="cta-image">${ctaImageAnchor3 ? ctaImageAnchor3.outerHTML : ""}</div>
</div>
</div>
`
`
);

// set the mobile background color
Expand Down
2 changes: 1 addition & 1 deletion blocks/testimonial/testimonial.css
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@

.section.testimonial-content-wrapper {
padding: 64px 0;
background-color: var(--cloud);
background-color: rgba(235,238,240,0.3);
}

.section.testimonial-content-wrapper .default-content-wrapper h2 {
Expand Down
10 changes: 7 additions & 3 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function moveAttributes(from, to, attributes) {
/* helper script start */
export let targetObject = {
model: null,
isMobile:window.matchMedia("(max-width: 1024px)").matches
isMobile: window.matchMedia("(max-width: 1024px)").matches
};

export function renderHelper(data, template, callBack) {
Expand Down Expand Up @@ -143,10 +143,10 @@ export function createCarousle(block, prevButton, nextButton) {
carousel.addEventListener("touchmove", drag);

carousel.addEventListener("wheel", scrollEvent); // Add scroll event listener
window.addEventListener("resize", () => {
function carouselResizeEventHandler() {
visibleSlides = getVisibleSlides();
setPositionByIndex();
});
}

function dragStart(event) {
isDragging = true;
Expand Down Expand Up @@ -249,6 +249,10 @@ export function createCarousle(block, prevButton, nextButton) {
checkLastChildVisibility();
}

window.addEventListener("resize", () => {
targetObject.isMobile = window.matchMedia("(max-width: 1024px)").matches;
carouselResizeEventHandler();
});
export function createButton(text, picture) {
const button = document.createElement("button");
button.classList.add("carousel-control", text);
Expand Down
1 change: 0 additions & 1 deletion styles/piramal-since/piramal-since.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
display: grid;
grid-template-columns: auto auto auto auto;
gap: 44px 86px;
justify-content: space-between;
text-align: center;
}

Expand Down

0 comments on commit a9b4961

Please sign in to comment.