2018-09-25 16:28:26 +00:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { computed } from '@ember/object';
|
2018-04-03 14:16:57 +00:00
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
|
2019-05-13 19:05:25 +00:00
|
|
|
/**
|
|
|
|
* @module DocLink
|
|
|
|
* `DocLink` components are used to render anchor links to relevant Vault documentation.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```js
|
|
|
|
<DocLink @path="/docs/secrets/kv/kv-v2.html">Learn about KV v2</DocLink>
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @param path="/"{String} - The path to documentation on vaultproject.io that the component should link to.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-04-03 14:16:57 +00:00
|
|
|
export default Component.extend({
|
|
|
|
tagName: 'a',
|
2018-08-28 05:03:55 +00:00
|
|
|
classNames: ['doc-link'],
|
2018-04-03 14:16:57 +00:00
|
|
|
attributeBindings: ['target', 'rel', 'href'],
|
|
|
|
|
|
|
|
layout: hbs`{{yield}}`,
|
|
|
|
|
|
|
|
target: '_blank',
|
|
|
|
rel: 'noreferrer noopener',
|
2018-11-14 20:56:03 +00:00
|
|
|
host: 'https://www.vaultproject.io',
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
path: '/',
|
2018-11-14 20:56:03 +00:00
|
|
|
href: computed('host', 'path', function() {
|
|
|
|
return `${this.host}${this.path}`;
|
2018-04-03 14:16:57 +00:00
|
|
|
}),
|
|
|
|
});
|