@@ -8,13 +8,30 @@ The site navigation system is built using a collection of custom WordPress block
88
99### Block Hierarchy
1010
11- The navigation system consists of four main blocks that work together:
11+ The navigation system consists of four main blocks that work together with a centralized styling approach :
1212
13- 1 . ** Navigation Wrapper** (` tribe/navigation-wrapper ` ) - Structural container
13+ 1 . ** Navigation Wrapper** (` tribe/navigation-wrapper ` ) - Central styling coordinator and structural container
14142 . ** Mega Menu Item** (` tribe/mega-menu-item ` ) - Complex dropdown menus
15153 . ** Standard Menu Item** (` tribe/standard-menu-item ` ) - Simple menu items with optional dropdowns
16164 . ** Navigation Link** (` tribe/navigation-link ` ) - Individual link items
1717
18+ ### CSS Architecture
19+
20+ The styling architecture follows a centralized coordinator pattern:
21+
22+ ** Navigation Wrapper** acts as the central styling coordinator that handles:
23+ - Consolidated toggle button styles (shared between mega and standard menu items)
24+ - First-level navigation styling with animated underlines
25+ - Context-specific behavior for Primary vs Utility menus
26+ - Responsive adaptations and mobile behavior
27+
28+ ** Individual Blocks** handle only their specific content:
29+ - ** Navigation Link** : Base link styling only
30+ - ** Mega Menu Item** : Dropdown container and content styling
31+ - ** Standard Menu Item** : Basic positioning and submenu wrapper styling
32+
33+ This architecture eliminates code duplication and creates a single source of truth for navigation styling.
34+
1835
1936## HTML Structure & Implementation
2037
@@ -102,16 +119,24 @@ The navigation system consists of four main blocks that work together:
102119
103120### 1. Navigation Wrapper (` tribe/navigation-wrapper ` )
104121
105- ** Purpose** : A structural block that wraps menu items in a semantic ` <nav> ` tag with no added styles .
122+ ** Purpose** : Central styling coordinator that provides semantic structure and handles all first-level navigation styling .
106123
107124** Location** : ` wp-content/themes/core/blocks/tribe/navigation-wrapper/ `
108125
109126** Features** :
110127- Provides semantic HTML structure with ` <nav> ` element
111128- Supports ` aria-label ` attribute for accessibility
112- - No visual styling (purely structural)
113- - Supports inner blocks and alignment
114- - Acts as a container for menu items
129+ - ** Consolidated toggle button styling** for both mega and standard menu items
130+ - ** Unified first-level navigation styling** with animated underlines
131+ - ** Context-aware styling** for Primary vs Utility menu placement
132+ - Responsive behavior and mobile adaptations
133+ - Acts as the styling foundation for all navigation components
134+
135+ ** Styling Responsibilities** :
136+ - Toggle button styles (chevrons, padding, hover states)
137+ - First-level navigation item styling (fonts, colors, underlines)
138+ - Context-specific overrides for different menu types
139+ - Mobile responsive adaptations
115140
116141** Attributes** :
117142- ` ariaLabel ` (string) - Accessible label for the navigation
@@ -125,17 +150,22 @@ The navigation system consists of four main blocks that work together:
125150
126151### 2. Mega Menu Item (` tribe/mega-menu-item ` )
127152
128- ** Purpose** : Enhanced dropdown menus with rich content capabilities for complex navigation structures .
153+ ** Purpose** : Handles mega menu dropdown content and container functionality .
129154
130155** Location** : ` wp-content/themes/core/blocks/tribe/mega-menu-item/ `
131156
132157** Features** :
133158- Configurable menu toggle label
134159- Uses pattern template (` patterns/mega-dropdown ` ) for consistent content structure
135160- Supports complex layouts and rich content within dropdowns
161+ - ** Container queries** for responsive dropdown layouts
136162- JavaScript interactions for opening/closing mega menus
137163- Event-driven architecture with custom events
138- - Full width layouts and grid alignment support
164+
165+ ** Styling Scope** :
166+ - ** Dropdown content styling only** (first-level button styling handled by Navigation Wrapper)
167+ - Container queries for responsive layouts
168+ - Mega menu wrapper positioning and background
139169
140170** Attributes** :
141171- ` menuToggleLabel ` (string) - Text label for the top-level navigation button
@@ -152,17 +182,22 @@ The navigation system consists of four main blocks that work together:
152182
153183### 3. Standard Menu Item (` tribe/standard-menu-item ` )
154184
155- ** Purpose** : Simple menu items with optional dropdown functionality for basic navigation needs .
185+ ** Purpose** : Handles basic menu item positioning and submenu wrapper functionality .
156186
157187** Location** : ` wp-content/themes/core/blocks/tribe/standard-menu-item/ `
158188
159189** Features** :
160190- Toggle for enabling simple dropdown submenus
161191- Only allows ` tribe/navigation-link ` as child blocks
162192- Configurable menu toggle label when used as dropdown
163- - Lightweight alternative to mega menu items
193+ - ** Lightweight positioning and layout ** (first-level styling handled by Navigation Wrapper)
164194- Perfect for simple link lists
165195
196+ ** Styling Scope** :
197+ - ** Basic positioning and layout only** (first-level button styling handled by Navigation Wrapper)
198+ - Toggle label styling (underline on hover)
199+ - Submenu wrapper positioning and behavior
200+
166201** Attributes** :
167202- ` hasSubMenu ` (boolean) - Enables dropdown functionality
168203- ` menuToggleLabel ` (string) - Text label when used as dropdown toggle
@@ -176,16 +211,20 @@ The navigation system consists of four main blocks that work together:
176211
177212### 4. Navigation Link (` tribe/navigation-link ` )
178213
179- ** Purpose** : Individual link items within menu structures .
214+ ** Purpose** : Provides base link styling with consistent behavior across all navigation contexts .
180215
181216** Location** : ` wp-content/themes/core/blocks/tribe/navigation-link/ `
182217
183218** Features** :
184219- Rich text editing for link text
185220- URL configuration with WordPress LinkControl component
186221- Target/new window option
187- - Can only be used as child of ` tribe/standard-menu-item `
188- - Proper link management with unlink functionality
222+ - ** Base link styling only** (context-specific enhancements handled by Navigation Wrapper)
223+ - Consistent foundation across all menu types
224+
225+ ** Styling Scope** :
226+ - ** Base link styles only** : underline, transitions, focus states
227+ - Context-specific styling (Primary vs Utility menu) handled by Navigation Wrapper
189228
190229** Attributes** :
191230- ` text ` (string) - Link text content
@@ -200,6 +239,46 @@ The navigation system consists of four main blocks that work together:
200239- Link control popover for URL management
201240- Toolbar controls for link/unlink actions
202241
242+ ## Styling Architecture
243+
244+ ### Centralized Coordinator Pattern
245+
246+ The navigation system uses a ** centralized coordinator pattern** where the Navigation Wrapper acts as the central styling authority:
247+
248+ ```
249+ Navigation Wrapper (Coordinator)
250+ ├── Toggle Button Styles (shared by mega & standard menu items)
251+ ├── First-Level Navigation Styling (animated underlines, hover states)
252+ ├── Context-Specific Overrides (Primary vs Utility menu)
253+ └── Responsive Adaptations (mobile behavior)
254+
255+ Individual Blocks (Content-Specific)
256+ ├── Navigation Link: Base link styles only
257+ ├── Mega Menu Item: Dropdown container & content
258+ └── Standard Menu Item: Basic positioning & submenu wrapper
259+ ```
260+
261+ ### Key Benefits
262+
263+ ** Eliminates Code Duplication** : Shared styles are defined once in Navigation Wrapper
264+ ** Single Source of Truth** : Navigation behavior modifications happen in one place
265+ ** Clear Separation** : Each block has a specific, well-defined styling responsibility
266+ ** Easy Maintenance** : Changes to navigation styling require updates to only one file
267+ ** Consistent Experience** : Unified first-level navigation behavior across all menu types
268+
269+ ### CSS File Organization
270+
271+ ** Navigation Wrapper** (` navigation-wrapper/style.pcss ` ):
272+ - Toggle button styles (consolidated)
273+ - Primary navigation first-level styles
274+ - Utility menu style overrides
275+ - Responsive behavior
276+
277+ ** Individual Block Files** :
278+ - ** Navigation Link** : Base link foundation only
279+ - ** Mega Menu Item** : Dropdown content and container queries
280+ - ** Standard Menu Item** : Simple positioning and submenu wrapper
281+
203282## JavaScript Architecture
204283
205284### Event System
@@ -259,6 +338,30 @@ The navigation system integrates with:
259338- Focus management for dropdown interactions
260339- Screen reader friendly markup
261340
341+ ## Development Guidelines
342+
343+ ### Working with the Centralized Architecture
344+
345+ #### ** Making Navigation Styling Changes**
346+
347+ ** For First-Level Navigation Changes** : Edit ` navigation-wrapper/style.pcss `
348+ - Toggle button styling (padding, colors, hover states)
349+ - Animated underlines and transitions
350+ - Font sizes and spacing
351+ - Context-specific behavior (Primary vs Utility)
352+
353+ ** For Individual Block Content** : Edit respective block files
354+ - ` navigation-link/style.pcss ` : Base link foundation only
355+ - ` mega-menu-item/style.pcss ` : Dropdown content and container queries
356+ - ` standard-menu-item/style.pcss ` : Basic positioning and submenu wrapper
357+
358+ ### Customization Points
359+
360+ - ** Navigation Wrapper** : Central coordinator for all first-level styling
361+ - ** Patterns** : Modify ` patterns/mega-dropdown ` for mega menu layouts
362+ - ** Individual Blocks** : Content-specific styling only
363+ - ** Context Selectors** : Use ` .site-header__navigation ` and ` .site-header__utility-menu ` for targeting
364+
262365## File Structure
263366
264367```
0 commit comments