Topbar active links, algorithm icons & styles
Add active state support to topbar links (routerLinkActive) and CSS underline/hover styling; expose icons for algorithm categories and render them in the algorithms list. Update AlgorithmCategory interface and AlgorithmsService to include icon names, import MatIconModule where needed, and adjust algorithms template to show icon, title and description layout. Global style tweaks: dark theme background, canvas shadows, card hover/gradient accents, and new styles for algorithm cards and page title for improved visual polish.
This commit is contained in:
@@ -3,4 +3,5 @@ export interface AlgorithmCategory {
|
||||
title: string;
|
||||
description: string;
|
||||
routerLink: string;
|
||||
icon: string;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
<div class="card-grid">
|
||||
<h1>{{ 'ALGORITHM.TITLE' |translate }}</h1>
|
||||
<h1 class="algo-page-title">{{ 'ALGORITHM.TITLE' | translate }}</h1>
|
||||
</div>
|
||||
<div class="card-grid">
|
||||
@for (category of categories; track category.id) {
|
||||
@for (category of categories; track category.id) {
|
||||
<mat-card class="algo-card" [routerLink]="[category.routerLink]">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{ category.title | translate }}</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<p>{{ category.description | translate}}</p>
|
||||
<div class="algo-icon-wrap">
|
||||
<mat-icon>{{ category.icon }}</mat-icon>
|
||||
</div>
|
||||
<h3 class="algo-card-title">{{ category.title | translate }}</h3>
|
||||
<p class="algo-card-desc">{{ category.description | translate }}</p>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,13 +3,14 @@ import { AlgorithmsService } from './algorithms.service';
|
||||
import { AlgorithmCategory } from './algorithm-category';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import {TranslatePipe} from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-algorithms',
|
||||
templateUrl: './algorithms.component.html',
|
||||
styleUrl: './algorithms.component.scss',
|
||||
imports: [RouterLink, MatCardModule, TranslatePipe],
|
||||
imports: [RouterLink, MatCardModule, MatIconModule, TranslatePipe],
|
||||
})
|
||||
export class AlgorithmsComponent {
|
||||
private readonly algorithmsService = inject(AlgorithmsService);
|
||||
|
||||
@@ -12,49 +12,57 @@ export class AlgorithmsService {
|
||||
id: 'pathfinding',
|
||||
title: 'ALGORITHM.PATHFINDING.TITLE',
|
||||
description: 'ALGORITHM.PATHFINDING.DESCRIPTION',
|
||||
routerLink: RouterConstants.PATHFINDING.LINK
|
||||
routerLink: RouterConstants.PATHFINDING.LINK,
|
||||
icon: 'route'
|
||||
},
|
||||
{
|
||||
id: 'sorting',
|
||||
title: 'ALGORITHM.SORTING.TITLE',
|
||||
description: 'ALGORITHM.SORTING.DESCRIPTION',
|
||||
routerLink: RouterConstants.SORTING.LINK
|
||||
routerLink: RouterConstants.SORTING.LINK,
|
||||
icon: 'sort'
|
||||
},
|
||||
{
|
||||
id: 'gameOfLife',
|
||||
title: 'ALGORITHM.GOL.TITLE',
|
||||
description: 'ALGORITHM.GOL.DESCRIPTION',
|
||||
routerLink: RouterConstants.GOL.LINK
|
||||
routerLink: RouterConstants.GOL.LINK,
|
||||
icon: 'grid_on'
|
||||
},
|
||||
{
|
||||
id: 'labyrinth',
|
||||
title: 'ALGORITHM.LABYRINTH.TITLE',
|
||||
description: 'ALGORITHM.LABYRINTH.DESCRIPTION',
|
||||
routerLink: RouterConstants.LABYRINTH.LINK
|
||||
routerLink: RouterConstants.LABYRINTH.LINK,
|
||||
icon: 'grid_view'
|
||||
},
|
||||
{
|
||||
id: 'fractal',
|
||||
title: 'ALGORITHM.FRACTAL.TITLE',
|
||||
description: 'ALGORITHM.FRACTAL.DESCRIPTION',
|
||||
routerLink: RouterConstants.FRACTAL.LINK
|
||||
routerLink: RouterConstants.FRACTAL.LINK,
|
||||
icon: 'blur_on'
|
||||
},
|
||||
{
|
||||
id: 'fractal3d',
|
||||
title: 'ALGORITHM.FRACTAL3D.TITLE',
|
||||
description: 'ALGORITHM.FRACTAL3D.DESCRIPTION',
|
||||
routerLink: RouterConstants.FRACTAL3d.LINK
|
||||
routerLink: RouterConstants.FRACTAL3d.LINK,
|
||||
icon: 'view_in_ar'
|
||||
},
|
||||
{
|
||||
id: 'pendulum',
|
||||
title: 'ALGORITHM.PENDULUM.TITLE',
|
||||
description: 'ALGORITHM.PENDULUM.DESCRIPTION',
|
||||
routerLink: RouterConstants.PENDULUM.LINK
|
||||
routerLink: RouterConstants.PENDULUM.LINK,
|
||||
icon: 'rotate_right'
|
||||
},
|
||||
{
|
||||
id: 'cloth',
|
||||
title: 'ALGORITHM.CLOTH.TITLE',
|
||||
description: 'ALGORITHM.CLOTH.DESCRIPTION',
|
||||
routerLink: RouterConstants.CLOTH.LINK
|
||||
routerLink: RouterConstants.CLOTH.LINK,
|
||||
icon: 'texture'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user