Skip to content

refactor(OGCard): adjust layout and migrate to TailwindCSS#13355

Merged
EurFelux merged 4 commits intomainfrom
style/og-card
Mar 10, 2026
Merged

refactor(OGCard): adjust layout and migrate to TailwindCSS#13355
EurFelux merged 4 commits intomainfrom
style/og-card

Conversation

@EurFelux
Copy link
Copy Markdown
Collaborator

@EurFelux EurFelux commented Mar 10, 2026

What this PR does

Before this PR:

  • OGCard used styled-components for styling with a fixed image area height of 9rem (144px), resulting in a 2.67:1 aspect ratio that heavily crops standard og:image (1.91:1)
  • Used antd Typography components for title and description
image image

After this PR:

  • Migrated OGCard styling from styled-components to TailwindCSS utility classes
  • Increased image area height to min-h-48 (192px), giving a ~2:1 aspect ratio that better fits standard og:image dimensions (1200×630, 1.91:1)
  • Replaced antd Typography.Title with MarqueeText component for title overflow handling
  • Replaced antd Typography.Paragraph with native div using line-clamp-3 for description truncation
  • Unified Container component for both card and skeleton states
image image

Fixes #13352

Why we need it and why it was done in this way

The following tradeoffs were made:

  • Chose min-h-48 (192px) as the image height to approximate the 1.91:1 standard og:image ratio within the w-96 (384px) container width
  • Migrated to TailwindCSS to reduce styled-components boilerplate (91 deletions, 36 additions)

The following alternatives were considered:

  • Using object-fit: contain instead of adjusting container size — rejected because it would leave blank space around landscape images

Breaking changes

None

Special notes for your reviewer

  • The overall card height changed from h-64 (256px) to h-72 (288px) to accommodate the taller image area
  • Description truncation changed from 2 lines to 3 lines

Checklist

Release note

NONE

- Increase image area height from 9rem to 12rem (min-h-48) for better
  og:image display with standard 1.91:1 aspect ratio
- Replace styled-components with TailwindCSS utility classes
- Replace antd Typography with MarqueeText and native elements
- Use line-clamp-3 for description truncation
- Unify Container component for both card and skeleton states

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: icarus <[email protected]>
Copy link
Copy Markdown
Contributor

@cherry-ai-bot cherry-ai-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the refactor — this is a clean migration that reduces boilerplate and fixes the og:image cropping issue.\n\nI left 2 non-blocking suggestions:\n1) confirm visual tradeoff is acceptable across portrait/square images\n2) consider unifying the skeleton image height with the live card ( / 192px) for easier future adjustments\n\nOverall LGTM.

<PreviewImageContainer>
<GeneratedGraph />
</PreviewImageContainer>
<div className="flex min-h-48 items-center justify-center">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call on — this better matches the 1.91:1 og:image standard. One thing to double-check: you switched the image to , which avoids cropping but may leave blank space for non-landscape images. The PR description mentions this alternative was rejected earlier; worth confirming the visual tradeoff is acceptable across common link previews (e.g., portrait vs. square images).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The visual effect of object-contain is acceptable for now — portrait/square images do leave some blank space, but it's a reasonable tradeoff over cropping.

Thanks for the review!

<StyledHyperLink>
<div className="flex min-h-0 flex-col overflow-hidden p-2">
<div className="mb-2 flex items-center gap-2">
{hostname && <Favicon hostname={hostname} alt={link} />}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice consolidation of for both card and skeleton states. Minor suggestion: consider extracting the skeleton height () to a constant or using the same utility class for consistency, so future adjustments to image area height don't require updating multiple places.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately Ant Design's Skeleton component doesn't play well with TailwindCSS utility classes, so extracting to a shared constant isn't straightforward here. We're planning to replace Ant Design in the near future, so this will be addressed as part of that migration.

Thanks for the suggestion!

Copy link
Copy Markdown
Contributor

@cherry-ai-bot cherry-ai-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean refactor that fixes the og:image cropping issue and reduces styled-components boilerplate. Author addressed my review comments reasonably. Waiting for CI to pass before merge.

@EurFelux EurFelux merged commit 759154a into main Mar 10, 2026
11 checks passed
@EurFelux EurFelux deleted the style/og-card branch March 10, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OGCard og:image overflows container and cannot display properly

2 participants