mirror of
https://github.com/discourse/discourse.git
synced 2024-12-20 20:03:46 +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 NavigationItem from "discourse/components/navigation-item";
|
||||||
import PluginOutlet from "discourse/components/plugin-outlet";
|
import PluginOutlet from "discourse/components/plugin-outlet";
|
||||||
import { filterTypeForMode } from "discourse/lib/filter-mode";
|
import { filterTypeForMode } from "discourse/lib/filter-mode";
|
||||||
|
import { applyValueTransformer } from "discourse/lib/transformer";
|
||||||
import icon from "discourse-common/helpers/d-icon";
|
import icon from "discourse-common/helpers/d-icon";
|
||||||
import DMenu from "float-kit/components/d-menu";
|
import DMenu from "float-kit/components/d-menu";
|
||||||
|
|
||||||
|
@ -26,6 +27,20 @@ export default class NavigationBarComponent extends Component {
|
||||||
return item || navItems[0];
|
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
|
@action
|
||||||
onRegisterApi(api) {
|
onRegisterApi(api) {
|
||||||
this.dMenu = api;
|
this.dMenu = api;
|
||||||
|
@ -33,7 +48,7 @@ export default class NavigationBarComponent extends Component {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ul id="navigation-bar" class="nav nav-pills">
|
<ul id="navigation-bar" class="nav nav-pills">
|
||||||
{{#if this.site.mobileView}}
|
{{#if this.showDropdown}}
|
||||||
<li>
|
<li>
|
||||||
<DMenu
|
<DMenu
|
||||||
@modalForMobile={{true}}
|
@modalForMobile={{true}}
|
||||||
|
@ -45,7 +60,7 @@ export default class NavigationBarComponent extends Component {
|
||||||
<span
|
<span
|
||||||
class="list-control-toggle-link__text"
|
class="list-control-toggle-link__text"
|
||||||
>{{this.selectedNavItem.displayName}}</span>
|
>{{this.selectedNavItem.displayName}}</span>
|
||||||
{{icon "discourse-chevron-expand"}}
|
{{icon this.navigationBarIcon}}
|
||||||
</:trigger>
|
</:trigger>
|
||||||
|
|
||||||
<:content>
|
<:content>
|
||||||
|
|
|
@ -15,6 +15,8 @@ export const VALUE_TRANSFORMERS = Object.freeze([
|
||||||
"more-topics-tabs",
|
"more-topics-tabs",
|
||||||
"move-to-topic-merge-options",
|
"move-to-topic-merge-options",
|
||||||
"move-to-topic-move-options",
|
"move-to-topic-move-options",
|
||||||
|
"navigation-bar-dropdown-mode",
|
||||||
|
"navigation-bar-dropdown-icon",
|
||||||
"parent-category-row-class-mobile",
|
"parent-category-row-class-mobile",
|
||||||
"parent-category-row-class",
|
"parent-category-row-class",
|
||||||
"post-menu-buttons",
|
"post-menu-buttons",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user