import { Component } from '@angular/core';
import { MatIconRegistry } from '@angular/material/icon';
import { DomSanitizer } from '@angular/platform-browser';
import { Router } from '@angular/router';


/**
 * @title Nested menu
 */
@Component({
  selector: 'app-menu-button',
  templateUrl: './menu-button.component.html',
  styleUrl: './menu-button.component.css'
})
export class MenuButtonComponent {
  public abierto: boolean = false;
  constructor(private iconRegistry: MatIconRegistry, sanitizer: DomSanitizer, private _router: Router) {
    this.iconRegistry.addSvgIcon('contacto', sanitizer.bypassSecurityTrustResourceUrl('assets/icons/contacto.svg'))
  }

  toggle() {
    this.abierto = !this.abierto;
  }

  close() {
    this.abierto = false;
  }

  category(id: string) {
    localStorage.setItem('categoria', id);
    this._router.navigate([`/home`]);

  }


}