fix(promo-banner): center by default + admin alignment selector (#482)
The gallery promotional banner (#440) read as visually offset from the gallery footer because: - Footer used `container text-center px-4` (full container width, centered text). - Promo block used `container py-4 sm:py-6` with an inner `max-w-3xl mx-auto` wrapper holding left-aligned text — a narrower column with left-aligned content sitting in the middle of the page. Two issues compounded: the column was narrower than the footer AND its text alignment differed. Reported by Rekoo-PS in #482 with a screenshot showing the misalignment, with a request for an admin alignment option. Fix: - Drop the inner max-w-3xl wrapper. Promo content now spans the same .container width as the footer, eliminating the narrower-column visual. - Default text alignment changed from left → center to match the footer. - New `branding_promo_alignment` setting ('left' | 'center' | 'right', default 'center'). Surfaced as a dropdown next to the existing Position dropdown on the BrandingPage. Live preview block on the BrandingPage mirrors the gallery render so admins see what guests will see. - Also replaced the no-op `prose-sm` prose-modifier with a real `prose prose-sm` outer class so the existing `prose-a:text-accent` modifier actually takes effect (it didn't before — modifiers without an outer .prose are silently ignored by Tailwind Typography). Migration 103 seeds the new setting at 'center' so existing installs that have a promo banner today see the corrected alignment immediately on next deploy. i18n: en + de hand-translated; nl/pt/ru/fr machine-translated and flagged for native review per project convention.
This commit is contained in:
@@ -47,6 +47,9 @@ interface GalleryLayoutProps {
|
||||
youtube_url?: string;
|
||||
promo_markdown?: string;
|
||||
promo_position?: 'above_footer' | 'below_footer';
|
||||
// Horizontal alignment for the promo content (#482). Defaults
|
||||
// to 'center' so the banner aligns with the footer.
|
||||
promo_alignment?: 'left' | 'center' | 'right';
|
||||
};
|
||||
showLogout?: boolean;
|
||||
onLogout?: () => void;
|
||||
@@ -226,12 +229,36 @@ export const GalleryLayout: React.FC<GalleryLayoutProps> = ({
|
||||
})().trim();
|
||||
const promoPosition: 'above_footer' | 'below_footer' = brandingSettings?.promo_position === 'below_footer' ? 'below_footer' : 'above_footer';
|
||||
|
||||
// Promo alignment (#482). Defaults to 'center' to match the gallery
|
||||
// footer's `text-center px-4` so the banner reads as part of the
|
||||
// same composition as the footer beneath it. Admin can flip to
|
||||
// 'left' or 'right' from Settings → Branding.
|
||||
const promoAlignment: 'left' | 'center' | 'right' =
|
||||
brandingSettings?.promo_alignment === 'left' ? 'left'
|
||||
: brandingSettings?.promo_alignment === 'right' ? 'right'
|
||||
: 'center';
|
||||
const promoTextAlignClass =
|
||||
promoAlignment === 'left' ? 'text-left'
|
||||
: promoAlignment === 'right' ? 'text-right'
|
||||
: 'text-center';
|
||||
|
||||
const promoSlot = promoMarkdown ? (
|
||||
<div className="gallery-promo border-t border-surface bg-surface/50">
|
||||
<div className="container py-4 sm:py-6">
|
||||
<div className="max-w-3xl mx-auto text-sm text-theme">
|
||||
<MarkdownContent source={promoMarkdown} className="prose-sm prose-a:text-accent" />
|
||||
</div>
|
||||
{/*
|
||||
* Inner block uses .container (matches the footer's container
|
||||
* width) + the alignment class. We deliberately drop the
|
||||
* previous max-w-3xl wrapper — it created a narrower column
|
||||
* that read as visually offset from the full-width footer
|
||||
* (#482, reported by Rekoo-PS). The `prose` class is needed
|
||||
* for the prose-a:text-accent modifier to actually take effect
|
||||
* (modifiers without an outer .prose are no-ops in Tailwind
|
||||
* Typography).
|
||||
*/}
|
||||
<div className={`container py-4 sm:py-6 px-4 ${promoTextAlignClass}`}>
|
||||
<MarkdownContent
|
||||
source={promoMarkdown}
|
||||
className={`prose prose-sm max-w-none mx-auto text-sm text-theme prose-a:text-accent ${promoTextAlignClass}`}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : null;
|
||||
|
||||
@@ -253,6 +253,11 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
|
||||
youtube_url: settingsData.branding_youtube_url || '',
|
||||
promo_markdown: settingsData.branding_promo_markdown || '',
|
||||
promo_position: settingsData.branding_promo_position === 'below_footer' ? 'below_footer' : 'above_footer',
|
||||
// Promo alignment (#482). Defaults to 'center' to match the
|
||||
// gallery footer; see GalleryLayout.
|
||||
promo_alignment: ['left', 'center', 'right'].includes(settingsData.branding_promo_alignment)
|
||||
? settingsData.branding_promo_alignment
|
||||
: 'center',
|
||||
});
|
||||
}
|
||||
}, [settingsData]);
|
||||
|
||||
Reference in New Issue
Block a user