Skip to content

Commit 005951e

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

File tree

14 files changed

+5315
-9
lines changed

14 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 tab.value) {
4+
<p-tab [value]="tab.value" (click)="updateNavigation(tab)">{{ tab.title }}</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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Component, Input, Output, EventEmitter } from '@angular/core';
2+
import { Tab, TabList, Tabs } from 'primeng/tabs';
3+
import { NavigationItems } from '../../models/NavigationItems';
4+
5+
const ZERO: number = 0;
6+
7+
@Component({
8+
selector: 'app-toggle-menu',
9+
imports: [Tabs, TabList, Tab],
10+
templateUrl: './toggle-menu.component.html',
11+
styleUrl: './toggle-menu.component.scss',
12+
})
13+
export class ToggleMenuComponent {
14+
@Input() tabs!: NavigationItems[];
15+
@Output() chosenTab: EventEmitter<string> = new EventEmitter<string>();
16+
17+
activeTabValue: number = ZERO;
18+
19+
updateNavigation(tab: NavigationItems): void {
20+
this.activeTabValue = tab.value;
21+
this.chosenTab.emit(tab.title);
22+
}
23+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export type NavigationItems = {
2+
title: string;
3+
value: number;
4+
};

src/app/common/models/Numbers.d.ts

Whitespace-only changes.
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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,45 @@
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+
.hidden {
35+
display: none;
36+
}
37+
}
38+
39+
.switch-map {
40+
position: absolute;
41+
bottom: 0;
42+
left: 50%;
43+
transform: translateX(-50%);
44+
}
645
}

0 commit comments

Comments
 (0)