Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
32 lines
802 B
JavaScript
32 lines
802 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { inject as service } from '@ember/service';
|
|
import { action } from '@ember/object';
|
|
import { tracked } from '@glimmer/tracking';
|
|
|
|
/*
|
|
`BreadcrumbsItem` inserts the crumbs to an existing container.
|
|
For our purposes, there will always be at most one container.
|
|
*/
|
|
|
|
export default class BreadcrumbsItemComponent extends Component {
|
|
@service('breadcrumbs') breadcrumbsService;
|
|
|
|
@tracked element = null;
|
|
|
|
@action
|
|
registerSelf(element) {
|
|
this.element = element;
|
|
}
|
|
|
|
get current() {
|
|
const crumbs = this.breadcrumbsService.containers[0].element.children;
|
|
const lastCrumb = crumbs[crumbs.length - 1];
|
|
return lastCrumb.isEqualNode(this.element);
|
|
}
|
|
}
|