Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/staging' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
aasmal97 committed Jun 12, 2023
2 parents 246b0cd + 91a5960 commit 75f1502
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 22 deletions.
39 changes: 24 additions & 15 deletions src/homePage/utilities/HomePageImageBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { Link } from "react-router-dom";
import { useRef } from "react";
import useIntersectionObserver from "../../hooks/use-intersection-observer";
import "react-lazy-load-image-component/src/effects/blur.css";
import useWindowWidth from "../../hooks/use-window-width";
const namespace = "home-page-img-banner";
export type HomePageImageBannerContentProps = {
title: string;
title?: string;
children: string | JSX.Element | JSX.Element[];
btnData: {
text: string;
Expand All @@ -18,25 +19,28 @@ export type HomePageImageBannerContentProps = {
) => void;
};
};
const HomePageHeader = ({ title }: { title?: string }) => {
const titleRef = useRef<HTMLHeadingElement | null>(null);
const titleEntry = useIntersectionObserver(titleRef, {});
const isTitleVisible = !!titleEntry?.isIntersecting;
return (
<h3
ref={titleRef}
className={`${namespace}-content-title${isTitleVisible ? " show" : ""}`}
>
{title}
</h3>
);
};
const HomePageImageBannerContent = ({
title,
children,
btnData,
}: HomePageImageBannerContentProps) => {
const titleRef = useRef<HTMLHeadingElement | null>(null);
const titleEntry = useIntersectionObserver(titleRef, {});
const isTitleVisible = !!titleEntry?.isIntersecting;
return (
<div className={`${namespace}-content-container`}>
<div className={`${namespace}-content`}>
<h3
ref={titleRef}
className={`${namespace}-content-title${
isTitleVisible ? " show" : ""
}`}
>
{title}
</h3>
{title ? <HomePageHeader title={title} /> : null}
<div className={`${namespace}-content-inner-container`}>{children}</div>
{btnData.url ? (
<Link
Expand Down Expand Up @@ -87,23 +91,28 @@ const HomePageImageBanner = ({
contentDirection?: "left" | "right";
} & ImageProps &
HomePageImageBannerContentProps) => {
const mediumWindowWidth = useWindowWidth(768);
return (
<div
className={`${namespace}-container${
customClass ? " " + customClass : ""
}`}
>
{contentDirection === "left" && (
{!mediumWindowWidth && <HomePageHeader title={title} />}
{(!mediumWindowWidth || contentDirection === "left") && (
<HomePageImageBannerImage
imgUrl={imgUrl}
imgDescription={imgDescription}
imgPlaceholderUrl={imgPlaceholderUrl}
/>
)}
<HomePageImageBannerContent title={title} btnData={btnData}>
<HomePageImageBannerContent
title={mediumWindowWidth ? title : ""}
btnData={btnData}
>
{children}
</HomePageImageBannerContent>
{contentDirection === "right" && (
{mediumWindowWidth && contentDirection === "right" && (
<HomePageImageBannerImage
imgUrl={imgUrl}
imgDescription={imgDescription}
Expand Down
33 changes: 26 additions & 7 deletions src/homePage/utilities/_homePageImageBannerBreakpoints.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
font-size: $font-size;
}
.#{$namespace}-content-inner-container {
font-size: $font-size * 0.6;
font-size: $font-size * 0.75;
}
.#{$namespace}-content-btn {
@include action-btn-styles(
Expand All @@ -55,23 +55,32 @@
.#{$namespace}-container {
position: relative;
flex-direction: column;
display: block;
}
.#{$namespace}-content-container {
padding: 10% 0;
//padding: 10% 0;
& > * {
width: 100%;
}
}
.#{$namespace}-content-title {
color: $black;
margin-bottom: 1.5em;
&::after {
background-color: $black;
}
};
}
.#{$namespace}-content-inner-container {
color: $black;
};
}

.#{$namespace}-img-container {
position: absolute;
aspect-ratio: 16/10;
width: 100%;
height: auto;
//position: absolute;
&::after {
position: absolute;
//position: absolute;
top: 0;
left: 0;
z-index: 0;
Expand All @@ -90,17 +99,27 @@
$namespace: "home-pg-img-banner-full";
.#{$namespace}-img-container {
position: relative;
aspect-ratio: 16/10;
&::after {
position: absolute;
width: 100%;
top: 0;
left: 0;
height: 100%;
content: "";
background-color: rgba(255, 255, 255, 0.75);
//background-color: rgba(0, 0, 0, 0.1);
background-color: rgba(255, 255, 255, 0.15);
z-index: 0;
}
}
// .#{$namespace}-content-title {
// // font-size: 1.8rem !important;
// // letter-spacing: 2%;
// // color: $white !important;
// // font-weight: 600 !important;
// // padding: 4em;
// // background-color: rgba(255, 255, 255, 0.4);
// }
.#{$namespace}-content-container {
min-width: unset;
$width: 60%;
Expand Down

0 comments on commit 75f1502

Please sign in to comment.