import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Platform } from '@ionic/angular';

@Component({
  selector: 'toolbar-button',
  templateUrl: './toolbar-button.component.html',
  styleUrls: ['./toolbar-button.component.scss'],
})
export class ToolbarButtonComponent implements OnInit {
  @Output() click = new EventEmitter();
  @Input() title;
  @Input() icon;
  public style = 'toolbar-button-android' ;
  constructor(
    private platform: Platform
  ) { }

  ngOnInit() {
    this.platform.ready().then( () => {
      this.style = this.platform.is('ios') ? 'toolbar-button-ios' : 'toolbar-button-android'  ;
    });
  }

  public onClick() {
    this.click.emit();
  }
}
