Skip to content

Commit 49f06e2

Browse files
Merge pull request #24 from Sarthakkad05/fix/hero-image-fit
feat(hero): add image fit prop to prevent SVG cropping
2 parents 62828cd + ebe402f commit 49f06e2

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ const props: supportUsButtonProps = {
175175
description: "", // ← your subheading
176176
sponsorLabel: "", // ← optional label above org info
177177
Image: { src: "", alt: "" }, // ← hero background image, Note: Remove the prop if you do not require a hero image.
178+
fit: "", // ← use "cover" for full-width images, "contain" for logo-style images to avoid cropping
178179
},
179180

180181
organizationInformation: {
@@ -198,7 +199,7 @@ const props: supportUsButtonProps = {
198199
description: "", // ← why people should sponsor
199200
sponsorLink: [
200201
{
201-
name: "Examplename"
202+
name: "Examplename",
202203
className: "sponsor-link",
203204
url: "https://example.com/sponsor",
204205
icon: null, // This Accepts ReactNode element(JSX)

src/components/SupportUsButton.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ function SupportUsButton({
7676
className={`w-full font-sans justify-center items-center text-center ${Theme == "light" || Theme == "dark" ? classAccordingToTheme(Theme) : "bg-black text-white"} ${classNames.container}`}
7777
>
7878
{/* Hero section with optional background image*/}
79-
<div className="relative w-full h-[50vh] flex justify-center">
79+
<div className="relative w-full h-[40vh] flex justify-center">
8080
{hero.Image && (
8181
<img
8282
src={hero.Image.src}
8383
alt={hero.Image.alt}
8484
title={hero.Image.alt}
85-
className="w-full h-full object-cover object-center pointer-none:cursor-none select-none"
85+
className={`w-full h-full ${
86+
hero.fit === "contain" ? "object-contain" : "object-cover"
87+
} object-center pointer-none:cursor-none select-none`}
8688
/>
8789
)}
8890
{/* Gradient overlay */}

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export type Hero = {
3131

3232
title: string;
3333
description: string;
34+
fit?: "cover" | "contain";
3435

3536
/** Label like: YOU'RE SPONSORING */
3637
sponsorLabel?: string;

0 commit comments

Comments
 (0)