Skip to content

Conversation

@adalcima
Copy link
Collaborator

@adalcima adalcima commented Feb 11, 2026

Description

This PR adds dynamic field visibility in the Hero Section based on the selected hero_variant. When users select "Side by Side", the hero_background_color field is automatically hidden since it's only applicable to the "Top to Bottom" layout variant.
This improves UX by preventing confusing configuration options and ensures content editors only see relevant fields for their selected layout.

  • Note: for the Dynamic Help Text for "Hero Image", this PR uses the fallback of updating the help text with fixed text for both variants, since the framework does not easily allow dynamic help text overwrites.

Related PRs/issues: https://mozilla-hub.atlassian.net/browse/TP1-3608

Main changes:

  • Existing Stimulus infrastructure reused
  • Replaced MultiFieldPanel with MediaPanel for Hero Section and configured trigger_field="hero_variant"
  • Field hero_background_color is required for the 'Top to Bottom' variant, but not for the 'Side by side' variant

How to test

  • Create/Edit a General Page
  • Open "Hero Section" panel
  • Test field visibility:
    Select "Side by Side" (hero_background_color should disappear)
    Select "Top to Bottom" (hero_background_color should appear)
  • Save/Publish

Images - Local tests (Review app in progress )

  • Top to bottom
image image
  • Side by side
image
  • Existing NP Hero section still working
image image

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.

1 participant