mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
c65b980ada
closes TryGhost/Team#2086
25 lines
602 B
JavaScript
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);
|
|
}
|
|
}
|