feat: tab-bar
This commit is contained in:
@@ -13,5 +13,7 @@
|
|||||||
>
|
>
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
<app-footer></app-footer>
|
<app-footer></app-footer>
|
||||||
|
<div class="md:min-h-0 min-h-16"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<app-tab-bar></app-tab-bar>
|
||||||
<app-notification></app-notification>
|
<app-notification></app-notification>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
.content {
|
.content {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
height: calc(100vh - 3rem);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { AppService } from "./app.service";
|
|||||||
import { FooterComponent } from "./components/footer/footer.component";
|
import { FooterComponent } from "./components/footer/footer.component";
|
||||||
import { HeaderComponent } from "./components/header/header.component";
|
import { HeaderComponent } from "./components/header/header.component";
|
||||||
import { NotificationComponent } from "./components/notification/notification.component";
|
import { NotificationComponent } from "./components/notification/notification.component";
|
||||||
|
import { TabBarComponent } from "./components/tab-bar/tab-bar.component";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -13,6 +14,7 @@ import { NotificationComponent } from "./components/notification/notification.co
|
|||||||
NotificationComponent,
|
NotificationComponent,
|
||||||
NotificationComponent,
|
NotificationComponent,
|
||||||
FooterComponent,
|
FooterComponent,
|
||||||
|
TabBarComponent,
|
||||||
],
|
],
|
||||||
selector: "app-root",
|
selector: "app-root",
|
||||||
templateUrl: "./app.component.html",
|
templateUrl: "./app.component.html",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="footer w-full border-t border-black bg-gray-300 pt-3 h-[15rem] overflow-hidden mt-3">
|
<div class="footer w-full border-t border-black bg-gray-300 pt-3 min-h-[15rem] mt-3">
|
||||||
<p class="text-3xl ps-[5rem]">DMCA Disclaimer</p>
|
<p class="text-3xl ps-[5rem]">DMCA Disclaimer</p>
|
||||||
<div class="footer-content h-full px-[5rem] flex flex-col gap-3">
|
<div class="footer-content h-full px-[5rem] flex flex-col gap-3">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
} @else {
|
} @else {
|
||||||
<div class="flex flex-col items-center w-full px-3">
|
<div class="flex flex-col items-center w-full px-3 mt-3">
|
||||||
@if (loading) {
|
@if (loading) {
|
||||||
<h1>Loading...</h1>
|
<h1>Loading...</h1>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
:host {
|
||||||
|
height: max-content;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<div
|
||||||
|
class="flex flex-row justify-start items-center md:hidden fixed bottom-0 w-full bg-gray-700 h-16 px-3"
|
||||||
|
>
|
||||||
|
@for (link of links; track link.link) {
|
||||||
|
<a [routerLink]="link.link">
|
||||||
|
<div class="tab-bar__item flex flex-col justify-center items-center h-full center w-16">
|
||||||
|
<i
|
||||||
|
[class]="
|
||||||
|
'text-3xl ' + link.line_icon + ' ' + (link.active ? 'text-white' : 'text-gray-500')
|
||||||
|
"
|
||||||
|
></i>
|
||||||
|
<span [class]="link.active ? 'text-white' : 'text-gray-500'">Auth</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { CommonModule } from "@angular/common";
|
||||||
|
import { Component, OnDestroy } from "@angular/core";
|
||||||
|
import { NavigationEnd, Router, RouterLink } from "@angular/router";
|
||||||
|
import { Subject, filter, takeUntil } from "rxjs";
|
||||||
|
import { ITab } from "./tab-bar.dto";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: "app-tab-bar",
|
||||||
|
standalone: true,
|
||||||
|
imports: [CommonModule, RouterLink],
|
||||||
|
templateUrl: "./tab-bar.component.html",
|
||||||
|
styleUrl: "./tab-bar.component.less",
|
||||||
|
})
|
||||||
|
export class TabBarComponent implements OnDestroy {
|
||||||
|
links: ITab[] = [
|
||||||
|
{
|
||||||
|
link: "/auth",
|
||||||
|
line_icon: "lni lni-user",
|
||||||
|
name: "Auth",
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
private destroy$ = new Subject<void>();
|
||||||
|
|
||||||
|
constructor(private router: Router) {
|
||||||
|
this.router.events
|
||||||
|
.pipe(
|
||||||
|
filter((event) => event instanceof NavigationEnd),
|
||||||
|
takeUntil(this.destroy$),
|
||||||
|
)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
.subscribe((event: any) => {
|
||||||
|
this.links.forEach((link) => {
|
||||||
|
link.active = event.url.startsWith(link.link);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
throw new Error("Method not implemented.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export interface ITab {
|
||||||
|
link: string;
|
||||||
|
line_icon: string;
|
||||||
|
name: string;
|
||||||
|
active: boolean;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user