FEATURE: add new plugin outlet 'after-header' (#26587)

* FEATURE: add new plugin outlet 'after-header'

* Add to widget version

* fix linting

---------

Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
Arpit Jalan
2024-04-10 16:26:57 +05:30
committed by GitHub
parent f8dd468caa
commit 5d0471ebe4
2 changed files with 23 additions and 4 deletions

View File

@@ -1,10 +1,12 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { getOwner } from "@ember/application";
import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { modifier } from "ember-modifier";
import { and, eq, not, or } from "truth-helpers";
import PluginOutlet from "discourse/components/plugin-outlet";
import DAG from "discourse/lib/dag";
import scrollLock from "discourse/lib/scroll-lock";
import DiscourseURL from "discourse/lib/url";
@@ -218,6 +220,10 @@ export default class GlimmerHeader extends Component {
{{/if}}
</Contents>
</div>
<PluginOutlet
@name="after-header"
@outletArgs={{hash minimized=this.header.topic}}
/>
</header>
</template>
}

View File

@@ -575,10 +575,23 @@ export default createWidget("header", {
minimized: !!attrs.topic,
};
return h(
"div.wrap",
this.attach("header-contents", { ...attrs, ...contentsAttrs })
);
return [
h(
"div.wrap",
this.attach("header-contents", { ...attrs, ...contentsAttrs })
),
new RenderGlimmer(
this,
"div.widget-component-connector",
hbs`
<PluginOutlet
@name="after-header"
@outletArgs={{hash minimized=@data.minimized}}
/>
`,
{ minimized: !!attrs.topic }
),
];
},
updateHighlight() {