import { Directive, ElementRef, Host, HostListener, Input } from '@angular/core';
import { showUserInfoObserver } from '../components/user-info-menu/user-info-menu.component';
import { AccountAvatarRecord } from '../server-services/query-records/account-records';

@Directive({
  selector: '[show-user-info]'
})
export class ShowUserInfoDirective {

  @Input('show-user-info') avatarInfo: AccountAvatarRecord;

  constructor(@Host() private elementRef: ElementRef) { }

  @HostListener('click')
  showUserInfo(){
    showUserInfoObserver.next({avatarInfo: this.avatarInfo, originElementRef: this.elementRef});
  }
}
