DEV: add transformers to navigation bar for theme dev (#30190)

This commit is contained in:
Kris 2024-12-09 17:20:45 -05:00 committed by GitHub
parent c546111703
commit b0a3017871
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import DropdownMenu from "discourse/components/dropdown-menu";
import NavigationItem from "discourse/components/navigation-item";
import PluginOutlet from "discourse/components/plugin-outlet";
import { filterTypeForMode } from "discourse/lib/filter-mode";
import { applyValueTransformer } from "discourse/lib/transformer";
import icon from "discourse-common/helpers/d-icon";
import DMenu from "float-kit/components/d-menu";
@ -26,6 +27,20 @@ export default class NavigationBarComponent extends Component {
return item || navItems[0];
}
get showDropdown() {
return applyValueTransformer(
"navigation-bar-dropdown-mode",
this.site.mobileView
);
}
get navigationBarIcon() {
return applyValueTransformer(
"navigation-bar-dropdown-icon",
"discourse-chevron-expand"
);
}
@action
onRegisterApi(api) {
this.dMenu = api;
@ -33,7 +48,7 @@ export default class NavigationBarComponent extends Component {
<template>
<ul id="navigation-bar" class="nav nav-pills">
{{#if this.site.mobileView}}
{{#if this.showDropdown}}
<li>
<DMenu
@modalForMobile={{true}}
@ -45,7 +60,7 @@ export default class NavigationBarComponent extends Component {
<span
class="list-control-toggle-link__text"
>{{this.selectedNavItem.displayName}}</span>
{{icon "discourse-chevron-expand"}}
{{icon this.navigationBarIcon}}
</:trigger>
<:content>

View File

@ -15,6 +15,8 @@ export const VALUE_TRANSFORMERS = Object.freeze([
"more-topics-tabs",
"move-to-topic-merge-options",
"move-to-topic-move-options",
"navigation-bar-dropdown-mode",
"navigation-bar-dropdown-icon",
"parent-category-row-class-mobile",
"parent-category-row-class",
"post-menu-buttons",