Skip to content

Conversation

@juabara
Copy link
Contributor

@juabara juabara commented Jan 20, 2026

🎯 Motivation

Simplified the Banner v2 component architecture by consolidating all data, state, and actions into a single bannerData prop that flows through all child components. This makes the structure more straightforward, with each component responsible for its own rendering logic and visibility decisions. Removed the children prop in favor of a fixed component hierarchy where all 11 child components are always rendered and decide internally whether to display based on the bannerData they receive.

🔧 Key Changes

  • Created BannerData interface consolidating all banner data, UI state, and actions
  • Refactored all child components (BannerLogo, BannerContent, BannerHeader, BannerTicker, BannerArticleCount, BannerBody, BannerVisual, BannerCtas, BannerChoiceCards, BannerCloseButton, BannerReminder) to accept single bannerData prop
  • Fixed BannerArticleCount visibility to match v1 behavior
  • Updated tests and Storybook stories to use simplified structure

✅ Verification

All existing functionality preserved (event tracking, state management, conditional rendering). No breaking changes to public API.


Juarez Mota added 4 commits January 15, 2026 11:11
…ion, and layout improvements

- Add close button functionality with channel timestamp storage and custom event dispatch
- Integrate tracking handlers for close, collapse, expand, and CTA clicks
- Add isOpen state to control banner visibility
- Reset selectedChoiceCard when choiceCards change
- Initialize isCollapsed to false instead of using isCollapsableBanner
- Create combined handlers that run both tracking and prop callbacks
@juabara juabara requested a review from a team as a code owner January 20, 2026 16:16
@github-actions
Copy link

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@juabara juabara added feature Departmental tracking: work on a new feature maintenance Departmental tracking: maintenance work, not a fix or a feature labels Jan 20, 2026
@github-actions
Copy link

github-actions bot commented Jan 20, 2026

@github-actions
Copy link

github-actions bot commented Jan 20, 2026

@juabara juabara marked this pull request as draft January 21, 2026 08:47

export interface CloseableBannerProps extends BannerProps {
onClose: () => void;
children?: React.ReactNode;
Copy link
Member

Choose a reason for hiding this comment

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

do we need this?

Juarez Mota and others added 2 commits January 21, 2026 15:46
…m hook

Move banner state management and data transformation logic from Banner component into useDesignableBannerModel hook. Extract selector logic into separate bannerSelectors module for better separation of concerns.
@juabara
Copy link
Contributor Author

juabara commented Jan 21, 2026

Improvements in state management

  • Centralized banner state/handlers/settings/selectors into a new useDesignableBannerModel hook to simplify Banner.tsx and keep state orchestration in one place.
  • Renamed selector fields for clarity and updated all banner subcomponents to consume the new names (e.g., copyForViewport, headingCopy, showChoiceCardCtas, showStandardCtas, showBodyVisual).
  • Kept existing behavior intact (collapse/open handling, tracking handlers, choice-card resets) while reducing conditional logic in child components.

@juabara juabara marked this pull request as ready for review January 21, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature maintenance Departmental tracking: maintenance work, not a fix or a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants