Skip to content

Commit 443a4ec

Browse files
authored
fix: sponsor image cropping and progressive ad preview (#256)
- Change object-fit from cover to contain on all sponsor image placements (banner, feed card, showcase grid) so logos with text aren't cropped at the edges - Make sponsor ad preview show progressively as fields are filled (title OR image OR description) instead of requiring both title AND image. Uses placeholder text for empty fields and lists remaining required fields below the preview.
1 parent 1e5aa02 commit 443a4ec

File tree

3 files changed

+37
-19
lines changed

3 files changed

+37
-19
lines changed

src/components/SponsorBanner.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
.sponsor-banner-image img {
5555
width: 100%;
5656
height: 100%;
57-
object-fit: cover;
57+
object-fit: contain;
5858
}
5959
6060
.sponsor-banner-content {

src/components/SponsorFeedCard.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
.sponsor-feed-image img {
7676
width: 100%;
7777
height: 100%;
78-
object-fit: cover;
78+
object-fit: contain;
7979
}
8080
8181
.sponsor-feed-title {

src/routes/sponsors/+page.svelte

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -658,25 +658,32 @@
658658
</div>
659659

660660
<!-- Live Preview -->
661-
{#if adTitle.trim() && adImageUrl}
662-
<div class="mt-4">
661+
{#if adTitle.trim() || adImageUrl || adDescription.trim()}
662+
<div class="mt-4 sponsor-preview-section">
663663
<h3 class="text-xs font-semibold uppercase mb-2" style="color: var(--color-caption); letter-spacing: 0.06em;">
664664
Preview
665665
</h3>
666-
{#if selectedTier === 'headline'}
667-
<SponsorBanner
668-
title={adTitle}
669-
description={adDescription}
670-
imageUrl={adImageUrl}
671-
linkUrl={adLinkUrl || '#'}
672-
/>
673-
{:else}
674-
<SponsorFeedCard
675-
title={adTitle}
676-
description={adDescription}
677-
imageUrl={adImageUrl}
678-
linkUrl={adLinkUrl || '#'}
679-
/>
666+
<div class="sponsor-preview-box">
667+
{#if selectedTier === 'headline'}
668+
<SponsorBanner
669+
title={adTitle || 'Your ad headline'}
670+
description={adDescription || 'Short description of your ad'}
671+
imageUrl={adImageUrl || ''}
672+
linkUrl={adLinkUrl || '#'}
673+
/>
674+
{:else}
675+
<SponsorFeedCard
676+
title={adTitle || 'Your ad headline'}
677+
description={adDescription || 'Short description of your ad'}
678+
imageUrl={adImageUrl || ''}
679+
linkUrl={adLinkUrl || '#'}
680+
/>
681+
{/if}
682+
</div>
683+
{#if !adTitle.trim() || !adImageUrl || !adLinkUrl.trim()}
684+
<p class="text-xs mt-1.5" style="color: var(--color-caption); opacity: 0.6;">
685+
{#if !adTitle.trim()}Title required. {/if}{#if !adImageUrl}Image required. {/if}{#if !adLinkUrl.trim()}Link URL required.{/if}
686+
</p>
680687
{/if}
681688
</div>
682689
{/if}
@@ -917,7 +924,7 @@
917924
.showcase-card-image img {
918925
width: 100%;
919926
height: 100%;
920-
object-fit: cover;
927+
object-fit: contain;
921928
}
922929
923930
.showcase-card-body {
@@ -1141,6 +1148,17 @@
11411148
object-fit: cover;
11421149
}
11431150
1151+
.sponsor-preview-section {
1152+
padding: 0.75rem;
1153+
border: 1px dashed var(--color-input-border);
1154+
border-radius: 0.75rem;
1155+
background: var(--color-bg-primary);
1156+
}
1157+
1158+
.sponsor-preview-box {
1159+
pointer-events: none;
1160+
}
1161+
11441162
.tier-card {
11451163
display: flex;
11461164
flex-direction: column;

0 commit comments

Comments
 (0)