/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { html } from "../vendor/lit.all.mjs"; import { MozLitElement } from "../lit-utils.mjs"; window.MozXULElement?.insertFTLIfNeeded("toolkit/global/mozPageHeader.ftl"); /** * A header component for providing context about a specific page. * * @tagname moz-page-header * @property {string} heading - The page title text. * @property {string} description - Secondary text shown under the heading. * @property {string} iconSrc - The src for an optional icon. * @property {string} supportPage - Optional URL for a related support article. * @property {boolean} backButton - Whether or not the header should include a back button. * @slot breadcrumbs - Container for a `; } iconTemplate() { if (!this.iconSrc) { return ""; } return html``; } descriptionTemplate() { if (!this.description) { return ""; } return html` ${this.description} ${this.supportLinkTemplate()}`; } supportLinkTemplate() { if (!this.supportPage) { return ""; } return html``; } handleBack() { this.dispatchEvent(new Event("navigate-back")); } render() { return html`
${this.backButtonTemplate()}${this.iconTemplate()}

${this.heading}

${!this.description ? this.supportLinkTemplate() : ""}
${this.descriptionTemplate()}
`; } } customElements.define("moz-page-header", MozPageHeader);