UNPKG

@hashicorp/design-system-components

Version:
38 lines (35 loc) 1.21 kB
import Component from '@glimmer/component'; import { on } from '@ember/modifier'; import HdsTHelper from '../../../helpers/hds-t.js'; import HdsButton from '../button/index.js'; import { precompileTemplate } from '@ember/template-compilation'; import { setComponentTemplate } from '@ember/component'; /** * Copyright IBM Corp. 2021, 2025 * SPDX-License-Identifier: MPL-2.0 */ class HdsAppHeaderMenuButton extends Component { get icon() { return this.args.isOpen ? 'x' : 'menu'; } onClick = () => { const { onClickToggle } = this.args; if (typeof onClickToggle === 'function') { onClickToggle(); } }; static { setComponentTemplate(precompileTemplate("<HdsButton class=\"hds-app-header__menu-button\" @text={{hdsT \"hds.components.common.menu\" default=\"Menu\"}} @icon={{this.icon}} @iconPosition=\"trailing\" {{on \"click\" this.onClick}} aria-controls={{@menuContentId}} aria-expanded={{if @isOpen \"true\" \"false\"}} ...attributes />", { strictMode: true, scope: () => ({ HdsButton, hdsT: HdsTHelper, on }) }), this); } } export { HdsAppHeaderMenuButton as default }; //# sourceMappingURL=menu-button.js.map