diff --git a/README.md b/README.md index 8c08ef40..25d52256 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ Hora de colocar a mão na massa. A parte mais divertida, trabalhar no código-fo ### 5 MISSÃO CUMPRIDA. VC AJUDOU O PROJETO. ❤️ +## Observções: +Verifique a versão do Node - Recomendamos Versão 10.x.x +Versões recentes tem apresentado instabilidades com pacotes presente no projeto. +Use o Angular 7+ + # Rodar o app pela primeira vez ```bash diff --git a/src/app/components/input-search/input-search.component.html b/src/app/components/input-search/input-search.component.html index c2795ae8..d60be158 100644 --- a/src/app/components/input-search/input-search.component.html +++ b/src/app/components/input-search/input-search.component.html @@ -12,4 +12,20 @@ + diff --git a/src/app/components/input-search/input-search.component.ts b/src/app/components/input-search/input-search.component.ts index 8e288cb5..205b2ef4 100644 --- a/src/app/components/input-search/input-search.component.ts +++ b/src/app/components/input-search/input-search.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { Router } from '@angular/router'; @@ -9,6 +9,7 @@ import { Router } from '@angular/router'; }) export class InputSearchComponent implements OnInit { public searchForm: FormGroup; + public searchAlert = false; constructor(private fb: FormBuilder, private _router: Router) {} @@ -19,6 +20,22 @@ export class InputSearchComponent implements OnInit { } public search(): void { - this._router.navigate(['/book/search', this.searchForm.value.paramSearch]); + // verifica se há alguma coisa na busca - senão houver exibe um alerta e não direciona pesquisa + if (this.searchForm.value.paramSearch){ + this._router.navigate(['/book/search', this.searchForm.value.paramSearch]); + this.searchAlert = false; + } else { + this.searchAlert = true; + } + + } + + @ViewChild("alert") alert: ElementRef; + + // remove o alerta, e joga para a home do site ajustando o menu novamente sem o alerta + closeAlert() { + this.alert.nativeElement.classList.remove("show"); + this._router.navigate(['/']); + this.searchAlert = false; } }