Files
vault/ui/lib/core/addon/components/namespace-reminder.js
claire bontempo e61bd967e3 Add docfy for addon components (#27188)
* move script to scripts folder

* add docfy to router and scripts

* add docfy to router and scripts

* fix jsdoc syntax

* add component markdown files to gitignore

* improve error handling for scripts

* tidy up remaining jsdoc syntax

* add sample jsdoc components

* add known issue info

* make not using multi-line components clearer

* make generating docs clearer

* update copy

* final how to docfy cleanup

* fix ts file @module syntax

* fix read more syntax

* make docfy typescript compatible
2024-05-29 14:06:38 -07:00

43 lines
1.1 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Component from '@glimmer/component';
import { service } from '@ember/service';
/**
* @module NamespaceReminder
* Renders a namespace reminder, typically used when creating a new item.
* _The namespace reminder only renders within a namespace, we cannot stub the namespace service here
* so manually wrote the component in the **example** below so it renders in docfy_
*
* @example
* <NamespaceReminder @mode="save" @noun="Auth Method" />
*
* <p class="namespace-reminder" id="namespace-reminder">
* This Auth Method will be saved in the <span class="tag">admin/</span>namespace.
* </p>
*
* @param {string} noun - item being created by form
* @param {string} [mode=edit] - action happening in form
*/
export default class NamespaceReminder extends Component {
@service namespace;
get showMessage() {
return !this.namespace.inRootNamespace;
}
get mode() {
return this.args.mode || 'edit';
}
get modeVerb() {
if (!this.mode) {
return '';
}
return this.mode.endsWith('e') ? `${this.mode}d` : `${this.mode}ed`;
}
}