mirror of
https://github.com/discourse/discourse.git
synced 2024-12-20 14:24:15 +08:00
DEV: add transformers to navigation bar for theme dev (#30190)
This commit is contained in:
parent
c546111703
commit
b0a3017871
|
@ -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>
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue
Block a user