import { Location } from "@angular/common";
import { Component, EventEmitter, HostListener, Output } from '@angular/core';
import { DeviceService } from '../../services/device.service';

@Component({
    selector: 'fm-back-button',
    templateUrl: './back-button.component.html',
    styleUrls: ['./back-button.component.scss'],
    standalone: false
})
export class BackButtonComponent {
  @Output() beforeLocationBack = new EventEmitter();

  @HostListener('click')
  onBackClicked() {
    this.beforeLocationBack.emit();
    this.location.back();
  }

  constructor(private location: Location,private deviceService:DeviceService) {    
  }

  public show() {
    return !this.deviceService.IsMobile();
  }
}
