Skip to content

Commit 3a7d0f0

Browse files
committed
now
1 parent 9419f5e commit 3a7d0f0

File tree

3 files changed

+52
-10
lines changed

3 files changed

+52
-10
lines changed

src/app/app.component.ts

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import { Component } from "@angular/core";
1+
import { Component, Inject, inject } from "@angular/core";
22
import { RouterOutlet } from "@angular/router";
33
import { HeaderComponent } from "./components/header.component";
44
import { FooterComponent } from "./components/footer.component";
5+
import { Subscription } from "rxjs";
6+
import { BlogInfo } from "./models/blog-info";
7+
import { BlogService } from "./services/blog.service";
8+
import { DOCUMENT } from "@angular/common";
59

610

711
@Component({
@@ -26,4 +30,42 @@ import { FooterComponent } from "./components/footer.component";
2630
`,
2731
],
2832
})
29-
export class AppComponent {}
33+
export class AppComponent {
34+
title = "angular-material-app";
35+
blogURL!: string;
36+
blogInfo!: BlogInfo;
37+
siteFavicon: any;
38+
blogService: BlogService = inject(BlogService);
39+
private querySubscription?: Subscription;
40+
41+
constructor(@Inject(DOCUMENT) private document: Document) {}
42+
43+
ngOnInit(): void {
44+
this.blogURL = this.blogService.getBlogURL();
45+
this.siteFavicon = this.document.querySelector(
46+
'link[rel="icon"]'
47+
) as HTMLLinkElement;
48+
this.querySubscription = this.blogService
49+
.getBlogInfo(this.blogURL)
50+
.subscribe((data) => {
51+
this.blogInfo = data;
52+
if (this.blogInfo.isTeam && this.blogInfo.favicon) {
53+
this.siteFavicon.href = this.blogInfo.favicon;
54+
} else {
55+
this.siteFavicon.href = "favicon.ico";
56+
}
57+
if (!this.blogInfo.isTeam) {
58+
this.blogService.getAuthorInfo(this.blogURL).subscribe((data) => {
59+
if (data.profilePicture) {
60+
this.siteFavicon.href = data.profilePicture;
61+
} else {
62+
this.siteFavicon.href = "favicon.ico";
63+
}
64+
});
65+
}
66+
});
67+
}
68+
ngOnDestroy(): void {
69+
this.querySubscription?.unsubscribe();
70+
}
71+
}

src/app/components/header.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,8 @@ import { FollowDialogComponent } from "../partials/follow-dialog.component";
126126
display: flex;
127127
align-items: center;
128128
justify-content: center;
129+
gap: 0.6rem;
129130
130-
.control-button {
131-
margin-right: 0.6rem;
132-
}
133131
}
134132
135133
.follow {

src/styles.scss

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ body {
6262
color: $button-color;
6363
}
6464

65-
.mat-mdc-text-field-wrapper {
66-
background-color: $button-bg !important;
67-
}
68-
6965
mat-toolbar {
7066
color: $light-text-color;
7167
color: $button-color;
@@ -104,7 +100,7 @@ body {
104100

105101
.search-result {
106102
&:hover {
107-
background-color: #444 !important;
103+
background-color: #808080a2;
108104
color: #a97aa7;
109105
}
110106
}
@@ -181,6 +177,12 @@ body {
181177
}
182178
}
183179

180+
.search-result {
181+
&:hover {
182+
color: $light-button-color;
183+
}
184+
}
185+
184186
.footer {
185187
background-color: $light-bg-color;
186188

0 commit comments

Comments
 (0)