Skip to content

Convert AZ Navbar to be a SDC#5408

Draft
djcelaya wants to merge 3 commits intomainfrom
navbar-az-sdc
Draft

Convert AZ Navbar to be a SDC#5408
djcelaya wants to merge 3 commits intomainfrom
navbar-az-sdc

Conversation

@djcelaya
Copy link
Copy Markdown
Contributor

See #5405.

Summary

Convert the AZ Navbar Twig override in az_barrio into a Single Directory Component.

This extracts the recursive navbar markup into a theme SDC, keeps the existing menu template as a thin presenter, and moves the navbar hover JavaScript into the component so the markup and behavior now live together.

Changes

  • Add a new az_main_navbar SDC in themes/custom/az_barrio/components/az_main_navbar/
  • Refactor menu--main-navbar-az.html.twig to render the SDC instead of owning the recursive menu macro directly
  • Simplify the component API to pass plain data across the SDC boundary
  • Move navbar hover behavior from a standalone theme library into az_main_navbar.js
  • Remove the old az-navbar-hover library definition and obsolete JS file
  • Extend AzBarrioTest to enable az_navbar during the test and verify the navbar variation and component-owned JS render correctly

Why

This continues the az_barrio SDC exploration with a more complex example than breadcrumb.

AZ Navbar was a useful next target because it exercises:

  • recursive Twig rendering
  • menu state handling
  • component-owned JavaScript
  • presenter-template integration with existing theme suggestion logic

Testing

  • lando drush cr
  • lando phpunit --filter AzBarrioTest

Notes

  • The presenter template still serves as the entry point for the az_navbar-specific menu suggestion
  • The component contract was reduced to plain data after runtime validation showed passing Drupal Attribute objects across the SDC boundary caused component validation errors
  • PHPUnit still reports an unrelated existing deprecation in az_migration

@djcelaya djcelaya self-assigned this Mar 12, 2026
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