fix: improve sponsor card UI consistency and layout#29
fix: improve sponsor card UI consistency and layout#29Sarthakkad05 wants to merge 1 commit intoAOSSIE-Org:mainfrom
Conversation
WalkthroughA single-file refactor of SupportUsButton.tsx that simplifies organization logo rendering by removing URL validation and conditional link wrapping, adjusts hero section height from 40vh to 50vh, removes responsive image-fit logic, and restructures sponsor cards from flex-wrap to grid layout with standardized logo containers. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/SupportUsButton.tsx`:
- Around line 278-282: The literal heading "Our Sponsors" in the SupportUsButton
component should be replaced with an i18n lookup; update the h2 in
SupportUsButton to call the project's translation function (e.g.,
t('ourSponsors') or useTranslations('supportUs').ourSponsors) instead of the
hardcoded string, import or use the existing i18n hook used across the codebase,
and add the "ourSponsors" key to the translation resource files with appropriate
entries and a sensible fallback so the heading renders when a translation is
missing.
- Around line 85-86: The img/className currently hard-codes "object-cover",
ignoring the Hero.fit?: "cover" | "contain" declared in the Hero type (see
Hero.fit in src/types/index.ts:34); restore conditional logic in the component
(SupportUsButton / the element with className="w-full h-full object-cover
object-center pointer-none:cursor-none select-none") to choose "object-cover"
when fit === "cover" and "object-contain" when fit === "contain" (or remove the
fit prop from the type if you intend to no longer support it) so consumers
passing fit:"contain" are respected.
- Around line 292-298: In SupportUsButton, avoid rendering an <a> with
href={sponsor.link} when sponsor.link is undefined: change the element that
wraps each sponsor to conditionally render an anchor only if sponsor.link is
present (preserve target, rel, title and key on that <a>), otherwise render a
non-link wrapper like a <div> or <button> with the same styling and key; ensure
you wrap the corresponding closing tag accordingly and move any click/aria
behavior into the non-link wrapper so accessibility and behavior remain correct.
- Around line 165-182: The render currently only checks typeof
organizationInformation.logo === "string" so when organizationInformation.logo
is undefined it falls into the <img> branch and produces a broken image; update
the conditional in SupportUsButton to first guard for a missing logo (e.g., if
(!organizationInformation.logo) render a safe fallback or null) and then handle
the string vs Image cases (keep the existing string branch for typeof
organizationInformation.logo === "string" and the <img> branch for when logo is
an Image with logo.src/logo.alt). Ensure you reference
organizationInformation.logo in the guard so no <img src={undefined}> is
rendered.
- Around line 240-247: The outer themed wrapper in the SupportUsButton component
is always rendered (the div using Theme and background classes) even when the
sponsors array is empty; update SupportUsButton to conditionally render the
entire sponsors section by checking that sponsors exists and has length (e.g.,
sponsors && sponsors.length > 0) and only then return the themed wrapper and its
inner content, so the background div is not emitted when there are no sponsors;
ensure the conditional encloses the whole block that begins with the current
Theme-based div and ends at its corresponding closing tag.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3150b393-6048-4536-88a6-169fc00b58bf
📒 Files selected for processing (1)
src/components/SupportUsButton.tsx
Description
This PR improves the UI and consistency of the sponsor cards in the
SupportUsButtoncomponent.Previously, sponsor cards had inconsistent sizes, overflowing logos, and non-uniform styling across different sponsorship tiers. This update standardizes the layout and enhances visual clarity.
Before vs After
Impact
Checklist
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.
Summary by CodeRabbit