From c74947376280fe8d8b1f8ca5db2ebcd0dd431f1b Mon Sep 17 00:00:00 2001 From: Romain <51331158+zylfu@users.noreply.github.com> Date: Fri, 21 Jan 2022 12:14:52 +0100 Subject: [PATCH] =?UTF-8?q?Page=20filters=20am=C3=A9liorations=20+=20Compo?= =?UTF-8?q?sant=20Avis-bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app-routing.module.ts | 2 +- src/app/app.module.ts | 6 +- .../filters/avis-bar/avis-bar.component.html | 10 +++ .../filters/avis-bar/avis-bar.component.scss | 0 .../avis-bar/avis-bar.component.spec.ts | 25 +++++++ .../filters/avis-bar/avis-bar.component.ts | 65 +++++++++++++++++++ src/app/filters/icon/icon.component.html | 3 + src/app/filters/icon/icon.component.scss | 0 src/app/filters/icon/icon.component.spec.ts | 25 +++++++ src/app/filters/icon/icon.component.ts | 22 +++++++ .../filters-page/filters-page.component.html | 47 +++++++++++++- .../filters-page/filters-page.component.scss | 8 +++ 12 files changed, 209 insertions(+), 4 deletions(-) create mode 100644 src/app/filters/avis-bar/avis-bar.component.html create mode 100644 src/app/filters/avis-bar/avis-bar.component.scss create mode 100644 src/app/filters/avis-bar/avis-bar.component.spec.ts create mode 100644 src/app/filters/avis-bar/avis-bar.component.ts create mode 100644 src/app/filters/icon/icon.component.html create mode 100644 src/app/filters/icon/icon.component.scss create mode 100644 src/app/filters/icon/icon.component.spec.ts create mode 100644 src/app/filters/icon/icon.component.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index d7dba24..97ed3a3 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -13,7 +13,7 @@ const routes: Routes = [ { path: 'home', component: HomePageComponent }, { path: 'categories', component: ListCategoriesComponent }, { path: 'favoris', component: FavorisUserComponent }, - { path: 'filters', component: FiltersPageComponent }, + { path: 'filtres', component: FiltersPageComponent }, { path: 'Deconnexion', redirectTo: 'home'}, {path: 'restaurants',component: RestoPageComponent}, {path: 'page-not-found',component: PageNotFoundComponent}, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e8c75af..89a0ef4 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -15,6 +15,8 @@ import { ListCategoriesComponent } from './pages/list-categories/list-categories import { RestoPageComponent } from './pages/resto-page/resto-page.component'; import { PageNotFoundComponent } from './pages/page-not-found/page-not-found.component'; import { FiltersPageComponent } from './pages/filters-page/filters-page.component'; +import { AvisBarComponent } from './filters/avis-bar/avis-bar.component'; +import { IconComponent } from './filters/icon/icon.component'; @NgModule({ declarations: [ @@ -28,7 +30,9 @@ import { FiltersPageComponent } from './pages/filters-page/filters-page.componen ListCategoriesComponent, RestoPageComponent, PageNotFoundComponent, - FiltersPageComponent + FiltersPageComponent, + AvisBarComponent, + IconComponent ], imports: [ BrowserModule, diff --git a/src/app/filters/avis-bar/avis-bar.component.html b/src/app/filters/avis-bar/avis-bar.component.html new file mode 100644 index 0000000..5d789dd --- /dev/null +++ b/src/app/filters/avis-bar/avis-bar.component.html @@ -0,0 +1,10 @@ +
+ +
diff --git a/src/app/filters/avis-bar/avis-bar.component.scss b/src/app/filters/avis-bar/avis-bar.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/filters/avis-bar/avis-bar.component.spec.ts b/src/app/filters/avis-bar/avis-bar.component.spec.ts new file mode 100644 index 0000000..dec29a8 --- /dev/null +++ b/src/app/filters/avis-bar/avis-bar.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AvisBarComponent } from './avis-bar.component'; + +describe('AvisBarComponent', () => { + let component: AvisBarComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ AvisBarComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(AvisBarComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/filters/avis-bar/avis-bar.component.ts b/src/app/filters/avis-bar/avis-bar.component.ts new file mode 100644 index 0000000..e176344 --- /dev/null +++ b/src/app/filters/avis-bar/avis-bar.component.ts @@ -0,0 +1,65 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-avis-bar', + templateUrl: './avis-bar.component.html', + styleUrls: ['./avis-bar.component.scss'] +}) +export class AvisBarComponent implements OnInit { + + starStates: {stateSelectedUser : boolean, stateHoverUser : boolean}[]; + + + constructor() { + + this.starStates = []; + + for (let index = 0; index < 5; index++) { + this.starStates.push( + { + stateSelectedUser : false, + stateHoverUser : false + } + ); + } + + } + + ngOnInit(): void { + } + + onMouseOver(index: number) { + console.log("star over", index); + for (let i = 0; i < this.starStates.length ; i++) { + if(i <= index) { + this.starStates[i].stateHoverUser = true; + } else { + this.starStates[i].stateHoverUser = false; + } + } + } + + onMouseLeave() { + const tempTab = []; + for (let index = 0; index < this.starStates.length; index++) { + tempTab.push( + { + stateSelectedUser : this.starStates[index].stateSelectedUser, + stateHoverUser : this.starStates[index].stateSelectedUser + } + ); + } + this.starStates = [...tempTab]; + } + + onClickStar(starIndex: number) { + for (let i = 0; i < this.starStates.length ; i++) { + if(i <= starIndex) { + this.starStates[i].stateSelectedUser = true; + } else { + this.starStates[i].stateSelectedUser = false; + } + } + } + +} diff --git a/src/app/filters/icon/icon.component.html b/src/app/filters/icon/icon.component.html new file mode 100644 index 0000000..8f39cd3 --- /dev/null +++ b/src/app/filters/icon/icon.component.html @@ -0,0 +1,3 @@ + + diff --git a/src/app/filters/icon/icon.component.scss b/src/app/filters/icon/icon.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/filters/icon/icon.component.spec.ts b/src/app/filters/icon/icon.component.spec.ts new file mode 100644 index 0000000..1719eb0 --- /dev/null +++ b/src/app/filters/icon/icon.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { IconComponent } from './icon.component'; + +describe('IconComponent', () => { + let component: IconComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ IconComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(IconComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/filters/icon/icon.component.ts b/src/app/filters/icon/icon.component.ts new file mode 100644 index 0000000..5de95a3 --- /dev/null +++ b/src/app/filters/icon/icon.component.ts @@ -0,0 +1,22 @@ +import { Component, OnInit } from '@angular/core'; +import { Input } from '@angular/core'; + +@Component({ + selector: 'app-icon', + templateUrl: './icon.component.html', + styleUrls: ['./icon.component.scss'] +}) +export class IconComponent implements OnInit { + + @Input() iconName!: string; + @Input() iconSize!: number; + @Input() iconColor!: string; + + constructor() { } + + ngOnInit(): void { + } + + + +} diff --git a/src/app/pages/filters-page/filters-page.component.html b/src/app/pages/filters-page/filters-page.component.html index 87f2558..3e306ef 100644 --- a/src/app/pages/filters-page/filters-page.component.html +++ b/src/app/pages/filters-page/filters-page.component.html @@ -12,9 +12,17 @@
- - +
+ Veuillez sélectionner la distance souhaitée +
+ +
+ 0 KM + 2 KM + 4 KM +
+
@@ -26,6 +34,17 @@
+ +
+ Veuillez sélectionner le prix souhaité +
+ +
+ 0€ + 10€ + 20€ +
+
@@ -38,6 +57,17 @@
+ +
+ Sur Place + A Emporter +
+
+ + +
+ +
@@ -50,6 +80,15 @@
+ +
+ Accès PMR +
+
+ + +
+
@@ -62,6 +101,10 @@
+
+ Choisissez parmi les avis déjà donnés +
+
diff --git a/src/app/pages/filters-page/filters-page.component.scss b/src/app/pages/filters-page/filters-page.component.scss index d7321c4..fe1e583 100644 --- a/src/app/pages/filters-page/filters-page.component.scss +++ b/src/app/pages/filters-page/filters-page.component.scss @@ -12,6 +12,7 @@ justify-content: flex-start; margin: 0 0 0.5em 8.2em; color: #CE0000; + margin-top: 100px; } @@ -25,6 +26,7 @@ margin-bottom: 100px; .accordion-body{ background-color: #F5F3F3; + text-align: center; } @@ -51,3 +53,9 @@ filter: drop-shadow(0 0 0.2rem grey); font-size: 20px; } + +span{ + font-weight: 500 ; +} + +