diff --git a/src/app/component/article-card-grid/article-card-grid.component.html b/src/app/component/article-card-grid/article-card-grid.component.html index 141cc38..f39e079 100644 --- a/src/app/component/article-card-grid/article-card-grid.component.html +++ b/src/app/component/article-card-grid/article-card-grid.component.html @@ -1,7 +1,9 @@
@for (article of articles; track article.id) { - - } @empty { Empty list of users } + + } @empty { + Empty list of users + }
diff --git a/src/app/component/article-card/article-card.component.html b/src/app/component/article-card/article-card.component.html index 8d6b241..c66273e 100644 --- a/src/app/component/article-card/article-card.component.html +++ b/src/app/component/article-card/article-card.component.html @@ -1,6 +1,19 @@ -
-

{{ article.title }}

-

{{ article.summary }}

-

{{ article.id }}

- Article +
+ +
+ Article Image +
+ + +
+

{{ article.title }}

+

{{ article.summary }}

+
diff --git a/src/app/component/article-card/article-card.component.ts b/src/app/component/article-card/article-card.component.ts index f0e3417..14352ec 100644 --- a/src/app/component/article-card/article-card.component.ts +++ b/src/app/component/article-card/article-card.component.ts @@ -1,5 +1,5 @@ -import { Component, Input } from '@angular/core'; -import { RouterLinkWithHref } from '@angular/router'; +import { Component, Input, inject } from '@angular/core'; +import { Router, RouterLinkWithHref } from '@angular/router'; import { Article } from '../../model/article.model'; @Component({ @@ -11,4 +11,10 @@ import { Article } from '../../model/article.model'; }) export class ArticleCardComponent { @Input({ required: true }) article!: Article; + + private router = inject(Router); + + onCardClick() { + this.router.navigate(['/blog', this.article.id, this.article.slug]); + } } diff --git a/src/app/model/article.model.ts b/src/app/model/article.model.ts index 34d865b..158f9fa 100644 --- a/src/app/model/article.model.ts +++ b/src/app/model/article.model.ts @@ -6,6 +6,7 @@ export interface Article { summary: string; slug: string; isActive: boolean; + coverImage?: string; } export interface ArticlesResponse {