mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-02 11:49:23 +00:00
26 lines
665 B
TypeScript
26 lines
665 B
TypeScript
import Component from '@ember/component';
|
|
import { get } from '@ember/object';
|
|
import { action } from '@ember-decorators/object';
|
|
import { Keyboard } from 'wherehows-web/constants/keyboard';
|
|
|
|
export default class AvatarsDetail extends Component {
|
|
containerClassNames = ['avatars-detail-modal'];
|
|
|
|
/**
|
|
* External action to close detail interface
|
|
*/
|
|
onClose: () => void;
|
|
|
|
/**
|
|
* Handles key up event on interface
|
|
* @param {KeyboardEvent} { key, which }
|
|
*/
|
|
@action
|
|
onKeyUp({ key, which }: KeyboardEvent) {
|
|
// if escape key, close modal
|
|
if (which === Keyboard.Escape || key === Keyboard[27]) {
|
|
get(this, 'onClose')();
|
|
}
|
|
}
|
|
}
|