Ghost/ghost/admin/app/components/tabs/tab.js
2022-10-19 15:20:15 +04:00

25 lines
602 B
JavaScript

import Component from '@glimmer/component';
import {action} from '@ember/object';
import {guidFor} from '@ember/object/internals';
export default class TabComponent extends Component {
id = this.args.id(`tab-${guidFor(this)}`);
index = this.args.index();
get isSelectedTab() {
return this.args.selectedIndex === this.index;
}
@action
handleClick() {
return this.args.onSelect(this.index);
}
@action
handleKeyup(event) {
event.stopPropagation();
event.preventDefault();
return this.args.onKeyup(event, this.index);
}
}