added search component from all pages
This commit is contained in:
36
src/app/components/search/search.css
Normal file
36
src/app/components/search/search.css
Normal file
@@ -0,0 +1,36 @@
|
||||
/* From Uiverse.io by LightAndy1 */
|
||||
.group {
|
||||
box-shadow: 0 1px 2px 1px #001529;
|
||||
border-radius: 15px;
|
||||
padding: 0.1rem 0.5rem 0.1rem 1rem;
|
||||
display: flex;
|
||||
line-height: 28px;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
line-height: 28px;
|
||||
padding: 0 1rem;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 8px;
|
||||
outline: none;
|
||||
background-color: #f3f3f4;
|
||||
color: #0d0c22;
|
||||
transition: 0.3s ease;
|
||||
}
|
||||
|
||||
.input::placeholder {
|
||||
color: #9e9ea7;
|
||||
}
|
||||
|
||||
.input:focus,
|
||||
input:hover {
|
||||
outline: none;
|
||||
border-color: #40A9FF;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 0 4px rgba(199, 199, 197, 0.1);
|
||||
}
|
||||
10
src/app/components/search/search.html
Normal file
10
src/app/components/search/search.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<form nz-form nzLayout="horizontal" [formGroup]="searchForm" (ngSubmit)="submitForm()">
|
||||
<nz-form-item nz-flex>
|
||||
<nz-form-control nzSpan="12">
|
||||
<div class="group">
|
||||
<nz-icon nzType="search" nzTheme="outline" class="mr-2 text-xl"></nz-icon>
|
||||
<input class="input" placeholder="Rechercher" formControlName="searchValue"/>
|
||||
</div>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</form>
|
||||
37
src/app/components/search/search.ts
Normal file
37
src/app/components/search/search.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent} from "ng-zorro-antd/form";
|
||||
import {FormControl, FormGroup, ReactiveFormsModule} from "@angular/forms";
|
||||
|
||||
@Component({
|
||||
selector: 'app-search',
|
||||
imports: [
|
||||
NzIconDirective,
|
||||
NzColDirective,
|
||||
NzFlexDirective,
|
||||
NzFormControlComponent,
|
||||
NzFormDirective,
|
||||
NzFormItemComponent,
|
||||
ReactiveFormsModule
|
||||
],
|
||||
templateUrl: './search.html',
|
||||
styleUrl: './search.css',
|
||||
})
|
||||
export class Search {
|
||||
searchForm: FormGroup = new FormGroup({
|
||||
searchValue: new FormControl<string>(null)
|
||||
})
|
||||
|
||||
submitForm() {
|
||||
// Pour annuler si le formulaire est invalide
|
||||
if (this.searchForm.invalid) return;
|
||||
|
||||
// Pour obtenir la valeur du formulaire
|
||||
console.log(this.searchForm.getRawValue())
|
||||
|
||||
// Pour vider le formulaire
|
||||
this.searchForm.reset()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user