Skip to content

Commit 7b46f3a

Browse files
committed
feat: add routing
- add info component
1 parent 83783eb commit 7b46f3a

8 files changed

+55
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="bg-pastel-red">
1+
<div class="min-h-screen bg-pastel-red">
22
<app-top-bar></app-top-bar>
3-
<app-album></app-album>
3+
<router-outlet></router-outlet>
44
</div>
+13-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
import { Routes } from '@angular/router';
2+
import {InfoComponent} from "./info/info.component";
3+
import {AlbumComponent} from "./album/album.component";
24

3-
export const routes: Routes = [];
5+
export const routes: Routes = [
6+
//{ path: '', redirectTo: 'albums', pathMatch: 'full' },
7+
{ path: 'albums', component: AlbumComponent },
8+
{ path: 'info', component: InfoComponent },
9+
/*{
10+
path: 'employees',
11+
component: EmployeeComponent,
12+
canActivate: [authGuard],
13+
data: { roles: ['Administrator', 'HRManager', 'ProjectManager'] }
14+
},*/
15+
]

src/CoinyProject.Client/src/app/info/info.component.css

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<div class="bg-white p-6 rounded-lg shadow-lg max-w-4xl mx-auto mt-8">
2+
<!-- Project Title -->
3+
<h1 class="text-3xl font-bold mb-4 text-gray-900">{{ projectTitle }}</h1>
4+
5+
<!-- Project Description -->
6+
<p class="text-gray-700 mb-4">
7+
{{ projectDescription }}
8+
</p>
9+
10+
<!-- How to Use -->
11+
<h2 class="text-2xl font-semibold mb-3 text-gray-900">How to Use the Platform</h2>
12+
13+
<p class="text-gray-700 mb-4">
14+
{{ projectUsage }}
15+
</p>
16+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-info',
5+
standalone: true,
6+
imports: [],
7+
templateUrl: './info.component.html',
8+
styleUrl: './info.component.css'
9+
})
10+
export class InfoComponent {
11+
projectTitle = 'COINY Project';
12+
projectDescription = `COINY is a platform designed to make it easier for users to explore and manage various items such as albums, auctions, and community posts. The platform offers a clean interface, dynamic navigation, and efficient management features.`;
13+
projectUsage = `To navigate through the platform, use the top navigation bar where you can switch between sections like "Home," "Albums," "Community," and "Auctions." Users can also log in, switch languages, and create new albums directly from the navigation interface. The project focuses on simplicity, ease of use, and efficient item management.`;
14+
}
Original file line numberDiff line numberDiff line change
@@ -1,17 +0,0 @@
1-
.nav-link {
2-
padding: 10px 20px; /* Consistent padding */
3-
min-width: 100px; /* Minimum width to accommodate text */
4-
text-align: center; /* Center the text */
5-
border: 2px solid transparent; /* Invisible border by default */
6-
border-radius: 8px; /* Rounded corners */
7-
transition: background-color 0.3s, color 0.3s, border-color 0.3s; /* Smooth transitions */
8-
}
9-
.nav-link:hover {
10-
background-color: #1a202c; /* Darker background on hover */
11-
color: #cbd5e0; /* Lighter text on hover */
12-
}
13-
.nav-link.active {
14-
background-color: #2b6cb0; /* Active background color */
15-
color: white; /* White text for active links */
16-
border-color: #2b6cb0; /* Matching border color */
17-
}

src/CoinyProject.Client/src/app/top-bar/top-bar.component.html

+5-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@
3636
</div>
3737

3838
<!-- Information Icon -->
39-
<a href="#" class="hover:text-gray-400 transition duration-200">
39+
<button (click)="navigateTo('Info')" class="hover:text-gray-400 transition duration-200 cursor-pointer">
4040
<i class="fas fa-info-circle"></i>
41-
</a>
41+
</button>
42+
4243
</div>
4344
</div>
4445
</div>
@@ -58,12 +59,12 @@
5859
Home
5960
</a>
6061

61-
<a href="#"
62+
<button
6263
(click)="navigateTo('Albums')"
6364
[ngClass]="{'text-yellow-400 font-semibold': activePage === 'Albums', 'text-gray-300': activePage !== 'Albums'}"
6465
class="hover:text-yellow-500 transition duration-200">
6566
Albums
66-
</a>
67+
</button>
6768

6869
<a href="#"
6970
(click)="navigateTo('Community')"

src/CoinyProject.Client/src/app/top-bar/top-bar.component.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component } from '@angular/core';
22
import {NgClass, NgForOf, NgIf, NgOptimizedImage} from "@angular/common";
3+
import {Router} from "@angular/router";
34

45
@Component({
56
selector: 'app-top-bar',
@@ -27,7 +28,7 @@ export class TopBarComponent {
2728
// Array of available languages
2829
availableLanguages: string[] = ['UA', 'EN'];
2930

30-
constructor() {}
31+
constructor(private router: Router) {}
3132

3233
// Toggle the language dropdown
3334
toggleLanguageDropdown() {
@@ -53,7 +54,9 @@ export class TopBarComponent {
5354
// Method to handle navigation clicks (for Home, Albums, etc.)
5455
navigateTo(page: string) {
5556
this.activePage = page;
56-
console.log(`Navigating to ${page}`);
57+
this.router.navigate([`/${page.toLowerCase()}`])
58+
.then(r => console.log('Navigating to Home'));
59+
5760
}
5861

5962
}

0 commit comments

Comments
 (0)