@alihbuzaid/ember-ui
Version:
Fleetbase UI provides all the interface components, helpers, services and utilities for building a Fleetbase extension into the Console.
36 lines (27 loc) • 883 B
JavaScript
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import generateUuid from '@fleetbase/ember-core/utils/generate-uuid';
export default class TabsComponent extends Component {
id = generateUuid();
activeTab = null;
onClick(tabName) {
const { onClick, onTabClick } = this.args;
this.activeTab = tabName;
if (typeof onClick === 'function') {
onClick(tabName);
}
if (typeof onTabClick === 'function') {
onTabClick(tabName);
}
}
onCreated(tabName) {
const { onTabCreated } = this.args;
if (this.activeTab === null) {
this.activeTab = tabName;
}
if (typeof onTabCreated === 'function') {
onTabCreated(tabName);
}
}
}