mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
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);
|
||
|
}
|
||
|
}
|