DEV: Merge mobile/desktop navigation-bar templates (#25017)

Having separate mobile/desktop templates is something we're moving away from. This commit moves the mobile-specific logic into a conditional in the main colocated template.
This commit is contained in:
David Taylor 2024-01-02 10:48:31 +00:00 committed by GitHub
parent fb95ab8e00
commit 34ae2080c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 49 deletions

View File

@ -1,17 +1,53 @@
{{#each this.navItems as |navItem|}}
<NavigationItem
@content={{navItem}}
@filterMode={{this.filterMode}}
@category={{this.category}}
class={{concat "nav-item_" navItem.name}}
{{#if this.site.mobileView}}
<li class="navigation-toggle">
<a href {{on "click" this.toggleDrop}} class="toggle-link">
{{this.selectedNavItem.displayName}}
{{d-icon "caret-down"}}
</a>
</li>
{{#if this.expanded}}
<ul class="drop">
{{#each this.navItems as |navItem|}}
<NavigationItem
@content={{navItem}}
@filterMode={{this.filterMode}}
@category={{this.category}}
class={{concat "nav-item_" navItem.name}}
/>
{{/each}}
<PluginOutlet
@name="extra-nav-item"
@connectorTagName="li"
@outletArgs={{hash
category=this.category
tag=this.tag
filterMode=this.filterMode
}}
/>
</ul>
{{/if}}
<PluginOutlet
@name="inline-extra-nav-item"
@connectorTagName="li"
@outletArgs={{hash category=this.category filterMode=this.filterMode}}
/>
{{/each}}
<PluginOutlet
@name="extra-nav-item"
@connectorTagName="li"
@outletArgs={{hash
category=this.category
tag=this.tag
filterMode=this.filterMode
}}
/>
{{else}}
{{#each this.navItems as |navItem|}}
<NavigationItem
@content={{navItem}}
@filterMode={{this.filterMode}}
@category={{this.category}}
class={{concat "nav-item_" navItem.name}}
/>
{{/each}}
<PluginOutlet
@name="extra-nav-item"
@connectorTagName="li"
@outletArgs={{hash
category=this.category
tag=this.tag
filterMode=this.filterMode
}}
/>
{{/if}}

View File

@ -1,33 +0,0 @@
<li class="navigation-toggle">
<a href {{on "click" this.toggleDrop}} class="toggle-link">
{{this.selectedNavItem.displayName}}
{{d-icon "caret-down"}}
</a>
</li>
{{#if this.expanded}}
<ul class="drop">
{{#each this.navItems as |navItem|}}
<NavigationItem
@content={{navItem}}
@filterMode={{this.filterMode}}
@category={{this.category}}
class={{concat "nav-item_" navItem.name}}
/>
{{/each}}
<PluginOutlet
@name="extra-nav-item"
@connectorTagName="li"
@outletArgs={{hash
category=this.category
tag=this.tag
filterMode=this.filterMode
}}
/>
</ul>
{{/if}}
<PluginOutlet
@name="inline-extra-nav-item"
@connectorTagName="li"
@outletArgs={{hash category=this.category filterMode=this.filterMode}}
/>