Skip to content

Commit 40ae0c8

Browse files
author
Emmanuelle BONOLI
committed
create reusable toggle navigation && change primary color ngPrime for our primary color
1 parent 4675bc3 commit 40ae0c8

File tree

12 files changed

+5315
-9
lines changed

12 files changed

+5315
-9
lines changed

src/app/app.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
display: flex;
44
flex-direction: column;
55
min-height: 100vh;
6+
white-space: pre-line;
67

78
.push-footer {
89
flex-grow: 1;

src/app/app.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { routes } from './app.routes';
77
import { provideHttpClient } from '@angular/common/http';
88
import { providePrimeNG } from 'primeng/config';
99
import { activitiesReducer } from './features/activity/store/activities.reducers';
10-
import Aura from '@primeng/themes/aura';
10+
import { myPreset } from './mytheme';
1111

1212
export const appConfig: ApplicationConfig = {
1313
providers: [
@@ -19,7 +19,7 @@ export const appConfig: ApplicationConfig = {
1919
provideStoreDevtools({ maxAge: 25 }),
2020
providePrimeNG({
2121
theme: {
22-
preset: Aura,
22+
preset: myPreset,
2323
},
2424
}),
2525
],
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<p-tabs [(value)]="activeTabValue">
2+
<p-tablist>
3+
@for (tab of tabs; track $index) {
4+
<p-tab [value]="tab" (click)="updateNavigation($index)">{{ tab }}</p-tab>
5+
}
6+
</p-tablist>
7+
</p-tabs>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
p-tablist::ng-deep {
2+
border-radius: 5px;
3+
overflow: hidden;
4+
}
5+
6+
p-tab:first-child::ng-deep {
7+
border-radius: 5px 0 0 5px;
8+
}
9+
10+
p-tab:last-child::ng-deep {
11+
border-radius: 0 5px 5px 0;
12+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Component, Input, Output, EventEmitter } from '@angular/core';
2+
import { Tab, TabList, Tabs } from 'primeng/tabs';
3+
4+
const ZERO: number = 0;
5+
6+
@Component({
7+
selector: 'app-toggle-menu',
8+
imports: [Tabs, TabList, Tab],
9+
templateUrl: './toggle-menu.component.html',
10+
styleUrl: './toggle-menu.component.scss',
11+
})
12+
export class ToggleMenuComponent {
13+
@Input() tabs!: string[];
14+
@Output() chosenTab: EventEmitter<string> = new EventEmitter<string>();
15+
16+
activeTabValue: number = ZERO;
17+
18+
updateNavigation(tabIndex: number): void {
19+
this.activeTabValue = tabIndex;
20+
this.chosenTab.emit(this.tabs[tabIndex]);
21+
}
22+
}
File renamed without changes.
Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
<div class="activities-home">
2-
@for (activity of activities$ | async; track activity.id) {
3-
<app-activity-card [activity]="activity"></app-activity-card>
4-
}
2+
<div class="search-activities">
3+
<!--TODO: rajouter ici composant qui regroupe les input de recherche pour la page activities-->
4+
</div>
5+
6+
<div class="cards-and-map">
7+
<div class="cards-activities" [ngClass]="chosenNavigation !== 'Liste' ? 'hidden' : ''">
8+
@for (activity of activities$ | async; track activity.id) {
9+
<app-activity-card [activity]="activity"></app-activity-card>
10+
}
11+
</div>
12+
<div class="map-activities" [ngClass]="chosenNavigation !== 'Carte' ? 'hidden' : ''">
13+
<!--TODO: rajouter ici composant map pour la page activities-->
14+
</div>
15+
</div>
16+
17+
<div class="switch-map">
18+
<app-toggle-menu [tabs]="navigationItems" (chosenTab)="handleNavigation($event)"></app-toggle-menu>
19+
</div>
520
</div>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,54 @@
11
.activities-home {
22
display: flex;
3+
flex-direction: column;
34
flex-wrap: wrap;
45
justify-content: space-around;
56
background-color: var(--background-color-light);
7+
width: 100vw;
8+
height: 80vh;
9+
position: relative;
10+
11+
.search-activities {
12+
border: 1px solid black;
13+
height: 150px;
14+
}
15+
16+
.cards-and-map {
17+
display: flex;
18+
width: 100%;
19+
20+
.cards-activities {
21+
width: 50%;
22+
display: flex;
23+
justify-content: space-around;
24+
flex-wrap: wrap;
25+
}
26+
27+
.map-activities {
28+
width: 50%;
29+
border: 1px solid black;
30+
flex-grow: 1;
31+
height: 50vh;
32+
}
33+
34+
@media screen and (max-width: 901px) {
35+
.hidden {
36+
display: none;
37+
}
38+
}
39+
}
40+
41+
.switch-map {
42+
display: none;
43+
}
44+
45+
@media screen and (max-width: 901px) {
46+
.switch-map {
47+
display: initial;
48+
position: absolute;
49+
bottom: 0;
50+
left: 50%;
51+
transform: translateX(-50%);
52+
}
53+
}
654
}

src/app/features/activity/pages/activities-home/activities-home.component.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import { ActivityCardComponent } from '../../components/activity-card/activity-c
33
import { ActivityFacadeService } from '../../services/activity-facade.service';
44
import { Activity } from '../../models/activity.model';
55
import { Observable } from 'rxjs';
6-
import { AsyncPipe } from '@angular/common';
6+
import { AsyncPipe, NgClass } from '@angular/common';
7+
import { ToggleMenuComponent } from '../../../../common/components/toggle-menu/toggle-menu.component';
78

89
@Component({
910
selector: 'app-activities-home',
10-
imports: [ActivityCardComponent, AsyncPipe],
11+
imports: [ActivityCardComponent, AsyncPipe, ToggleMenuComponent, NgClass],
1112
templateUrl: './activities-home.component.html',
1213
styleUrl: './activities-home.component.scss',
1314
standalone: true,
@@ -17,7 +18,14 @@ export class ActivitiesHomeComponent implements OnInit {
1718

1819
activities$: Observable<Activity[]> = this.activityFacadeService.activities$;
1920

21+
navigationItems: string[] = ['Liste', 'Carte'];
22+
chosenNavigation: string = 'Liste';
23+
2024
ngOnInit(): void {
2125
this.activityFacadeService.getAllActivities();
2226
}
27+
28+
handleNavigation(title: string): void {
29+
this.chosenNavigation = title;
30+
}
2331
}

src/app/features/header/header.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ header {
33
justify-content: space-between;
44
align-items: center;
55
padding: 0 1% 0 1%;
6-
margin-bottom: 4%;
6+
margin-bottom: 1%;
77
color: var(--primary-dark-color);
88
box-shadow: var(--box-shadow);
99

0 commit comments

Comments
 (0)