DEV: Minor cleanup of navbar components (#25222)

Convert components to template-only where applicable.
This commit is contained in:
Jarek Radosz 2024-01-11 19:20:27 +01:00 committed by GitHub
parent c2aa64b251
commit 3a0bf97401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 77 additions and 87 deletions

View File

@ -1,4 +1,3 @@
import Component from "@glimmer/component";
import { hash } from "@ember/helper";
import CloseDrawerButton from "./close-drawer-button";
import CloseThreadButton from "./close-thread-button";
@ -11,8 +10,7 @@ import ThreadTrackingDropdown from "./thread-tracking-dropdown";
import ThreadsListButton from "./threads-list-button";
import ToggleDrawerButton from "./toggle-drawer-button";
export default class ChatNavbarActions extends Component {
<template>
const ChatNavbarActions = <template>
<nav class="c-navbar__actions">
{{yield
(hash
@ -29,5 +27,6 @@ export default class ChatNavbarActions extends Component {
)
}}
</nav>
</template>
}
</template>;
export default ChatNavbarActions;

View File

@ -1,9 +1,7 @@
import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
import ChannelTitle from "discourse/plugins/chat/discourse/components/channel-title";
export default class ChatNavbarChannelTitle extends Component {
<template>
const ChatNavbarChannelTitle = <template>
{{#if @channel}}
<LinkTo
@route="chat.channel.info.members"
@ -13,5 +11,6 @@ export default class ChatNavbarChannelTitle extends Component {
<ChannelTitle @channel={{@channel}} />
</LinkTo>
{{/if}}
</template>
}
</template>;
export default ChatNavbarChannelTitle;

View File

@ -1,4 +1,3 @@
import Component from "@glimmer/component";
import { hash } from "@ember/helper";
import { on } from "@ember/modifier";
import concatClass from "discourse/helpers/concat-class";
@ -8,8 +7,7 @@ import BackButton from "./back-button";
import ChannelTitle from "./channel-title";
import Title from "./title";
export default class ChatNavbar extends Component {
<template>
const ChatNavbar = <template>
{{! template-lint-disable no-invalid-interactive }}
<div
class={{concatClass "c-navbar-container" (if @onClick "-clickable")}}
@ -26,5 +24,6 @@ export default class ChatNavbar extends Component {
}}
</nav>
</div>
</template>
}
</template>;
export default ChatNavbar;

View File

@ -1,7 +1,4 @@
import Component from "@glimmer/component";
export default class ChatNavbarSubTitle extends Component {
<template>
const ChatNavbarSubTitle = <template>
<div class="c-navbar__sub-title">
{{#if (has-block)}}
{{yield}}
@ -9,5 +6,6 @@ export default class ChatNavbarSubTitle extends Component {
{{@title}}
{{/if}}
</div>
</template>
}
</template>;
export default ChatNavbarSubTitle;

View File

@ -1,23 +1,18 @@
import Component from "@glimmer/component";
import { hash } from "@ember/helper";
import icon from "discourse-common/helpers/d-icon";
import SubTitle from "./sub-title";
export default class ChatNavbarTitle extends Component {
<template>
const ChatNavbarTitle = <template>
<div title={{@title}} class="c-navbar__title">
{{#if (has-block)}}
{{#if @icon}}
{{icon @icon}}
{{/if}}
{{if @icon (icon @icon)}}
{{@title}}
{{yield (hash SubTitle=SubTitle)}}
{{else}}
{{#if @icon}}
{{icon @icon}}
{{/if}}
{{if @icon (icon @icon)}}
{{@title}}
{{/if}}
</div>
</template>
}
</template>;
export default ChatNavbarTitle;