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

fix(hero image): add prop to maintain aspect ratio of image #776

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 11 additions & 2 deletions components/PageHeader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import Image from "next/image";

export default function PageHeader({ src, srcMobile, title, titleDown, text }) {
export default function PageHeader({
src,
srcMobile,
title,
titleDown,
text,
maintainAspectRatio,
}) {
return (
<>
<div
Expand All @@ -11,7 +18,9 @@ export default function PageHeader({ src, srcMobile, title, titleDown, text }) {
"h-[calc(100vh-8rem)] lg:h-[50vh]"
}`}
>
<div className={`relative ${titleDown ? "h-[50vh]" : "h-full"}`}>
<div
className={`relative ${titleDown ? "h-[max(75vw,300px)] sm:h-[min(50vw,600px)]" : "h-full"} ${maintainAspectRatio ? "w-[min(100%,1800px)] sm:h-[min(50vw,900px)] m-auto" : ""}`}
>
{src && (
<Image
alt={`${title} Cover`}
Expand Down
1 change: 1 addition & 0 deletions components/SolutionArticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function Solution(props) {
srcMobile={solution.pageCoverMobile}
title={solution.title}
titleDown
maintainAspectRatio
/>
<Article body={solution.body} imageSizes={solution.imageSizes} />
<ContactPerson
Expand Down
Loading