-
{{article.title}}
+
+
+ -1)">
+
+
+
+
+
+
+
+
+
{{article.title}}
+
{{article.description}}
{{article.body}}
+
+
Creation Date: {{article.createdAt}}
+
+
+ -1)">
+
+
+
+
+
+
+
+
-
-
-{{tags | json}}
-
diff --git a/src/app/articles/articles.component.scss b/src/app/articles/articles.component.scss
index e69de29..1ee17b8 100644
--- a/src/app/articles/articles.component.scss
+++ b/src/app/articles/articles.component.scss
@@ -0,0 +1,48 @@
+.articlesHeader {
+ font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
+ text-align: center;
+ background-color: beige;
+ padding: 1.2rem;
+ .title { color: darkmagenta; }
+}
+
+.tagList, .myTagList {
+ display: flex;
+ justify-content: flex-start;
+ tag {
+ flex-direction: column;
+ flex-wrap: wrap;
+ margin-right: 1rem;
+ }
+}
+
+.tagButton, .myTagButton {
+ font-family: Arial, Helvetica, sans-serif;
+ margin-right: 0.3rem;
+ border: none;
+ border-radius: 0.3rem;
+ padding: 0.3rem;
+ background-color: darkmagenta;
+ color: white;
+}
+
+.article {
+ font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
+ background-color: whitesmoke;
+ padding-left: 0.5rem;
+ padding-right: 0.5rem;
+}
+
+.comment>textarea {
+ resize: none;
+}
+
+.commentButton {
+ font-family: Arial, Helvetica, sans-serif;
+ margin-right: 0.3rem;
+ border: none;
+ border-radius: 0.3rem;
+ padding: 0.5rem;
+ background-color: navy;
+ color: white;
+}
diff --git a/src/app/articles/articles.component.ts b/src/app/articles/articles.component.ts
index 434bf47..38ace3b 100644
--- a/src/app/articles/articles.component.ts
+++ b/src/app/articles/articles.component.ts
@@ -8,17 +8,31 @@ import { ArticlesService } from '../articles.service';
})
export class ArticlesComponent implements OnInit {
- articles:any = []
+ articles: any = [];
tags: any = [];
- constructor(private service: ArticlesService) { }
+ constructor(private service: ArticlesService) { this.loadTags(); }
- ngOnInit(): void {
+ ngOnInit(): void { }
- }
loadArticles() {
- this.service.getArticles().subscribe(response => this.articles = response.articles);
+ this.service.getArticles().subscribe((response) => {
+ this.articles = response.articles;
+ });
+ }
+
+ loadNArticlesForTag(tag: any, quantity: number) {
+ this.service.getArticlesByTag(tag).subscribe((response) => {
+ this.articles = response.articles.slice(0, quantity);
+ });
}
+
loadTags() {
- this.service.getTags().subscribe(response => this.tags = response.tags);
+ this.service.getTags().subscribe((response) => {
+ this.tags = response.tags;
+ });
+ }
+
+ createNewComment(text: string, endpoint: string) {
+ this.service.postNewComment(text, endpoint);
}
}
diff --git a/src/assets/space-background.jpg b/src/assets/space-background.jpg
new file mode 100644
index 0000000..b09d983
Binary files /dev/null and b/src/assets/space-background.jpg differ
diff --git a/src/styles.scss b/src/styles.scss
index 90d4ee0..c93ebea 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -1 +1,10 @@
/* You can add global styles to this file, and also import other style files */
+body {
+ margin: 0.5rem;
+ background-color: cornsilk;
+ background-image: url("assets/space-background.jpg");
+ background-position: center center;
+ background-repeat: no-repeat;
+ background-attachment: fixed;
+ background-size: cover;
+}