Skip to content

Commit a0fb579

Browse files
Merge pull request #78 from AnguHashBlog/main
Going back to using Layout Component due to issues with Sidebar
2 parents 937ae67 + 8fe3cca commit a0fb579

File tree

136 files changed

+111
-81
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+111
-81
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

CONTRIBUTING.md

+2-2

angular-primeng-app/README.md

-27
This file was deleted.

angular-primeng-app/src/app/app.routes.ts

-23
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

angular-primeng-app/src/app/app.component.html renamed to src/app/app.component.html

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
<app-header />
2-
<div class="content">
3-
<router-outlet />
4-
</div>
5-
<app-footer />
1+
<router-outlet />
62

73
@if (showScrollButton) {
84
<p-button class="scroll-btn" (click)="scrollToTop()" icon="pi pi-angle-up" [rounded]="true" size="small"></p-button>

src/app/app.component.scss

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.scroll-btn {
2+
position: fixed;
3+
bottom: 1rem;
4+
right: 1rem;
5+
}
6+
File renamed without changes.

src/app/app.routes.ts

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Routes } from "@angular/router";
2+
import { PostDetailsComponent } from "./components/post-details/post-details.component";
3+
import { PostsComponent } from "./components/posts/posts.component";
4+
import { SeriesComponent } from "./components/series/series.component";
5+
import { LayoutComponent } from "./components/layout/layout.component";
6+
7+
export const routes: Routes = [
8+
{
9+
path: "",
10+
component: LayoutComponent,
11+
children: [
12+
{
13+
path: "",
14+
component: PostsComponent,
15+
},
16+
{
17+
path: "series/:slug",
18+
component: SeriesComponent,
19+
},
20+
],
21+
},
22+
{
23+
path: "post/:postSlug",
24+
component: PostDetailsComponent,
25+
},
26+
{
27+
path: "**",
28+
redirectTo: "",
29+
},
30+
];

angular-primeng-app/src/app/components/header/header.component.html renamed to src/app/components/header/header.component.html

-8
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,21 @@
22
<div class="toolbar-row first">
33
<div class="p-toolbar-group-start">
44
<a routerLink="/" class="blog-title">
5-
@if (showMainHeader) {
65
<img class="logo-image" src="{{blogImage}}" alt="logo" />
7-
} @else {
8-
<app-sidenav></app-sidenav>
9-
}
106
<h1>{{blogName}}</h1>
117
</a>
128
</div>
139

1410
<div class="p-toolbar-group-end">
1511
<div class="controls">
16-
@if (showMainHeader) {
1712
<app-search-dialog [blogId]="blogId"></app-search-dialog>
1813
<app-settings-dialog></app-settings-dialog>
19-
}
2014
<p-inputSwitch [(ngModel)]="checked" (click)="onThemeChange(checked ? 'dark' : 'light')"
2115
id="theme-switch"></p-inputSwitch>
2216
</div>
2317
</div>
2418
</div>
2519

26-
@if (showMainHeader) {
2720
<div class="toolbar-row second">
2821
<div class="p-toolbar-group-start">
2922
<div class="social">
@@ -58,6 +51,5 @@ <h1>{{blogName}}</h1>
5851
}
5952
</div>
6053
</div>
61-
}
6254

6355
</p-toolbar>

angular-primeng-app/src/app/components/header/header.component.ts renamed to src/app/components/header/header.component.ts

-9
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ import { InputSwitchModule } from "primeng/inputswitch";
1515
import { DialogModule } from "primeng/dialog";
1616
import { SettingsDialogComponent } from "../../partials/settings-dialog/settings-dialog.component";
1717
import { FollowDialogComponent } from "../../partials/follow-dialog/follow-dialog.component";
18-
import { SidenavComponent } from "../sidenav/sidenav.component";
1918

2019
@Component({
2120
selector: "app-header",
2221
standalone: true,
2322
imports: [
2423
AsyncPipe,
25-
SidenavComponent,
2624
SearchDialogComponent,
2725
SettingsDialogComponent,
2826
FollowDialogComponent,
@@ -38,7 +36,6 @@ import { SidenavComponent } from "../sidenav/sidenav.component";
3836
styleUrl: "./header.component.scss",
3937
})
4038
export class HeaderComponent implements OnInit, OnDestroy {
41-
showMainHeader: boolean = true;
4239
blogURL!: string;
4340
blogInfo!: BlogInfo;
4441
blogId: string = "";
@@ -85,12 +82,6 @@ export class HeaderComponent implements OnInit, OnDestroy {
8582
this.blogService.getSeriesList(this.blogURL).subscribe((data) => {
8683
this.seriesList = data;
8784
});
88-
this.router.events.subscribe((event) => {
89-
if (event instanceof NavigationEnd) {
90-
this.showMainHeader =
91-
!this.route.snapshot.firstChild?.paramMap.has("postSlug");
92-
}
93-
});
9485
}
9586

9687
onThemeChange(theme: string): void {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<app-header />
2+
<div class="content">
3+
<router-outlet />
4+
</div>
5+
<app-footer />

angular-primeng-app/src/app/app.component.scss renamed to src/app/components/layout/layout.component.scss

-7
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,3 @@
55
min-height: 74vh;
66
width: 100%;
77
}
8-
9-
.scroll-btn {
10-
position: fixed;
11-
bottom: 1rem;
12-
right: 1rem;
13-
}
14-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { LayoutComponent } from './layout.component';
4+
5+
describe('LayoutComponent', () => {
6+
let component: LayoutComponent;
7+
let fixture: ComponentFixture<LayoutComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
imports: [LayoutComponent]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(LayoutComponent);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component } from '@angular/core';
2+
import { HeaderComponent } from '../header/header.component';
3+
import { FooterComponent } from '../footer/footer.component';
4+
import { RouterOutlet } from '@angular/router';
5+
6+
@Component({
7+
selector: 'app-layout',
8+
standalone: true,
9+
imports: [HeaderComponent, FooterComponent, RouterOutlet],
10+
templateUrl: './layout.component.html',
11+
styleUrl: './layout.component.scss'
12+
})
13+
export class LayoutComponent {
14+
15+
}

angular-primeng-app/src/app/components/post-details/post-details.component.html renamed to src/app/components/post-details/post-details.component.html

+15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
<div class="post-details-page">
2+
<p-toolbar>
3+
<div class="p-toolbar-group-start">
4+
<app-sidenav></app-sidenav>
5+
<a routerLink="/" class="logo">
6+
<h1>{{blogName}}</h1>
7+
</a>
8+
</div>
9+
<div class="p-toolbar-group-end">
10+
<app-search-dialog [blogId]="blogId"></app-search-dialog>
11+
<p-inputSwitch [(ngModel)]="checked" (click)="onThemeChange(checked ? 'dark' : 'light')"
12+
id="theme-switch"></p-inputSwitch>
13+
</div>
14+
</p-toolbar>
15+
216
@if (post$ | async; as post) {
317
<article>
418
<h1 class="title">{{ post.title }}</h1>
@@ -34,4 +48,5 @@ <h1 class="title">{{ post.title }}</h1>
3448
<div class="content" [innerHTML]="post.content.html | sanitizerHtml" youtubeVideoEmbed></div>
3549
</article>
3650
}
51+
<app-footer></app-footer>
3752
</div>

angular-primeng-app/src/app/components/post-details/post-details.component.scss renamed to src/app/components/post-details/post-details.component.scss

+14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
.post-details-page {
2+
p-toolbar {
3+
.p-toolbar-group-start {
4+
h1 {
5+
font-size: 1.3rem;
6+
font-weight: 500;
7+
margin: 0;
8+
}
9+
}
10+
11+
.p-toolbar-group-end {
12+
gap: 0.625rem;
13+
}
14+
}
15+
216
article {
317
margin: 0 auto;
418
max-width: 50vw;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)