diff --git a/src/app/components/trip-card/trip-card.component.ts b/src/app/components/trip-card/trip-card.component.ts
index eb6eee8..38f5322 100644
--- a/src/app/components/trip-card/trip-card.component.ts
+++ b/src/app/components/trip-card/trip-card.component.ts
@@ -1,10 +1,11 @@
import { Component, Input } from '@angular/core';
import { Trip } from '../../../data/trips';
+import { RouterLink } from '@angular/router';
@Component({
selector: 'app-trip-card',
standalone: true,
- imports: [],
+ imports: [RouterLink],
templateUrl: './trip-card.component.html',
styleUrl: './trip-card.component.css',
})
diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html
index 08171ab..9f2c545 100644
--- a/src/app/pages/home/home.component.html
+++ b/src/app/pages/home/home.component.html
@@ -1,25 +1,4 @@
-
-
-
-
-
-
Explore Trips
-
-
-
-
-
-
-
-@if (selectedTrip) {
-
-}
diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts
index 00f224f..cb81a01 100644
--- a/src/app/pages/home/home.component.ts
+++ b/src/app/pages/home/home.component.ts
@@ -21,35 +21,4 @@ import { NavbarComponent } from '../../components/navbar/navbar.component';
templateUrl: './home.component.html',
styleUrl: './home.component.css',
})
-export class HomeComponent {
- trips: Trip[] = trips;
- filteredTrips: Trip[] = [...trips];
- selectedTrip: Trip = trips[0];
- searchQuery: string = '';
- activeDifficultyFilter: DifficultyLevel = 'All';
-
- handleSearch(searchTerm: string) {
- this.searchQuery = searchTerm.toLowerCase();
- this.applyFilters();
- }
-
- handleFilter(difficulty: DifficultyLevel) {
- this.activeDifficultyFilter = difficulty;
- this.applyFilters();
- }
-
- private applyFilters() {
- this.filteredTrips = this.trips.filter((trip) => {
- const matchesSearch =
- !this.searchQuery ||
- trip.name.toLowerCase().includes(this.searchQuery.toLowerCase()) ||
- trip.city.toLowerCase().includes(this.searchQuery.toLowerCase())
-
- const matchesDifficulty =
- this.activeDifficultyFilter === 'All' ||
- trip.difficulty === this.activeDifficultyFilter;
-
- return matchesSearch && matchesDifficulty;
- });
- }
-}
+export class HomeComponent {}
diff --git a/src/app/pages/trip/trip.component.css b/src/app/pages/trip/trip.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/pages/trip/trip.component.html b/src/app/pages/trip/trip.component.html
new file mode 100644
index 0000000..f0c9eae
--- /dev/null
+++ b/src/app/pages/trip/trip.component.html
@@ -0,0 +1,3 @@
+@if (trip) {
+
+}
diff --git a/src/app/pages/trip/trip.component.spec.ts b/src/app/pages/trip/trip.component.spec.ts
new file mode 100644
index 0000000..4c19a5b
--- /dev/null
+++ b/src/app/pages/trip/trip.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TripComponent } from './trip.component';
+
+describe('TripComponent', () => {
+ let component: TripComponent;
+ let fixture: ComponentFixture
;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [TripComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(TripComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/pages/trip/trip.component.ts b/src/app/pages/trip/trip.component.ts
new file mode 100644
index 0000000..4759594
--- /dev/null
+++ b/src/app/pages/trip/trip.component.ts
@@ -0,0 +1,24 @@
+import { Component } from '@angular/core';
+import { ActivatedRoute, Router } from '@angular/router';
+import { Trip, trips } from '../../../data/trips';
+import { TripDetailsComponent } from '../../components/trip-details/trip-details.component';
+
+@Component({
+ selector: 'app-trip',
+ standalone: true,
+ imports: [TripDetailsComponent],
+ templateUrl: './trip.component.html',
+ styleUrl: './trip.component.css',
+})
+export class TripComponent {
+ trips = trips;
+ trip: Trip | undefined = this.trips[0];
+ constructor(private route: ActivatedRoute, private router: Router) {
+ const slug: string = this.route.snapshot.paramMap.get('slug')!;
+ console.log(slug);
+ this.trip = this.trips.find((trip) => trip.slug === slug.toString()); // Find the fruit by ID
+ if (!this.trip) {
+ this.router.navigate(['/trips']);
+ }
+ }
+}
diff --git a/src/app/pages/trips-list/trips-list.component.css b/src/app/pages/trips-list/trips-list.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/pages/trips-list/trips-list.component.html b/src/app/pages/trips-list/trips-list.component.html
new file mode 100644
index 0000000..022da23
--- /dev/null
+++ b/src/app/pages/trips-list/trips-list.component.html
@@ -0,0 +1,13 @@
+
+
+
+
Explore Trips
+
+
+
+
+
+
diff --git a/src/app/pages/trips-list/trips-list.component.spec.ts b/src/app/pages/trips-list/trips-list.component.spec.ts
new file mode 100644
index 0000000..354f397
--- /dev/null
+++ b/src/app/pages/trips-list/trips-list.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TripsListComponent } from './trips-list.component';
+
+describe('TripsListComponent', () => {
+ let component: TripsListComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [TripsListComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(TripsListComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/pages/trips-list/trips-list.component.ts b/src/app/pages/trips-list/trips-list.component.ts
new file mode 100644
index 0000000..95dd0e5
--- /dev/null
+++ b/src/app/pages/trips-list/trips-list.component.ts
@@ -0,0 +1,60 @@
+import { Component } from '@angular/core';
+import { DifficultyLevel, Trip, trips } from '../../../data/trips';
+import { SearchFilterComponent } from '../../components/search-filter/search-filter.component';
+import { DividerComponent } from '../../components/divider/divider.component';
+import { TripsGridComponent } from '../../components/trips-grid/trips-grid.component';
+import { ActivatedRoute, Router } from '@angular/router';
+
+@Component({
+ selector: 'app-trips-list',
+ standalone: true,
+ imports: [SearchFilterComponent, DividerComponent, TripsGridComponent],
+ templateUrl: './trips-list.component.html',
+ styleUrl: './trips-list.component.css',
+})
+export class TripsListComponent {
+ trips: Trip[] = trips;
+ filteredTrips: Trip[] = [...trips];
+ // selectedTrip: Trip = trips[0];
+ searchQuery: string = '';
+ activeDifficultyFilter: DifficultyLevel = 'All';
+
+ constructor(private route: ActivatedRoute, private router: Router) {
+ this.route.queryParams.subscribe((params) => {
+ const difficulty = params['difficulty'] as DifficultyLevel;
+ if (difficulty && ['Easy', 'Moderate', 'Hard'].includes(difficulty)) {
+ this.activeDifficultyFilter = difficulty;
+ this.applyFilters();
+ }
+ });
+ }
+
+ handleSearch(searchTerm: string) {
+ this.searchQuery = searchTerm.toLowerCase();
+ this.applyFilters();
+ }
+
+ handleFilter(difficulty: DifficultyLevel) {
+ this.activeDifficultyFilter = difficulty;
+ this.router.navigate([], {
+ queryParams: { difficulty: difficulty !== 'All' ? difficulty : null },
+ queryParamsHandling: 'merge',
+ });
+ this.applyFilters();
+ }
+
+ private applyFilters() {
+ this.filteredTrips = this.trips.filter((trip) => {
+ const matchesSearch =
+ !this.searchQuery ||
+ trip.name.toLowerCase().includes(this.searchQuery.toLowerCase()) ||
+ trip.city.toLowerCase().includes(this.searchQuery.toLowerCase());
+
+ const matchesDifficulty =
+ this.activeDifficultyFilter === 'All' ||
+ trip.difficulty === this.activeDifficultyFilter;
+
+ return matchesSearch && matchesDifficulty;
+ });
+ }
+}
diff --git a/src/data/trips.ts b/src/data/trips.ts
index 6d7c0ba..3187cd9 100644
--- a/src/data/trips.ts
+++ b/src/data/trips.ts
@@ -75,7 +75,7 @@ export const trips: Trip[] = [
},
{
id: 6,
- name: 'Ajloun Hike',
+ name: 'Maarij Hike',
slug: 'ajloun-hike',
city: 'ajloun',
length: '30',