Skip to content

Commit 0341744

Browse files
committed
style: update navbar mobile menu style
1 parent 2f43971 commit 0341744

File tree

5 files changed

+37
-32
lines changed

5 files changed

+37
-32
lines changed

src/app/modules/layout/components/navbar/navbar-mobile/navbar-mobile-menu/navbar-mobile-menu.component.html

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<div class="pt-4" *ngFor="let menu of menuService.pagesMenu">
22
<div class="mx-1 mb-2 flex items-center justify-between">
3-
<small class="text-muted-foreground text-xs font-semibold">
3+
<small class="text-muted-foreground/50 text-xs font-semibold">
44
{{ menu.group }}
55
</small>
66
</div>
7-
<ul class="flex flex-col space-y-1">
7+
<ul class="flex flex-col">
88
<!-- List items -->
99
<li *ngFor="let item of menu.items">
1010
<!-- Menu List -->
11-
<div (click)="toggleMenu(item)" class="text-muted-foreground hover:text-foreground group relative">
11+
<div
12+
(click)="toggleMenu(item)"
13+
class="text-muted-foreground hover:text-foreground group flex grow items-center gap-4">
1214
<!-- Icon -->
1315
<div
1416
[ngClass]="item.active && !menuService.showSideBar ? 'text-primary' : 'text-muted-foreground/50'"
15-
class="pointer-events-none absolute m-2">
17+
class="pointer-events-none">
1618
<svg-icon src="{{ item.icon }}" [svgClass]="'h-5 w-5'"> </svg-icon>
1719
</div>
1820

@@ -26,20 +28,20 @@
2628
<ng-template #parentMenu let-item="item">
2729
<div
2830
routerLink="{{ item.route }}"
29-
class="hover:bg-card flex h-9 cursor-pointer items-center justify-start rounded-sm">
31+
class="text-muted-foreground hover:text-primary flex h-[36px] cursor-pointer items-center justify-start rounded-sm">
3032
<a
3133
routerLinkActive="text-primary"
32-
(click)="closeMenu()"
33-
class="truncate text-xs font-semibold tracking-wide focus:outline-hidden ltr:ml-10 rtl:mr-10">
34+
class="truncate text-xs font-semibold tracking-wide focus:outline-hidden">
3435
{{ item.label }}
3536
</a>
3637
</div>
3738
</ng-template>
3839

3940
<!-- Workaround:: Disable routerLink -->
4041
<ng-template #childMenu let-item="item">
41-
<div class="hover:bg-card flex h-9 cursor-pointer items-center justify-start rounded-sm">
42-
<a class="truncate text-xs font-semibold tracking-wide focus:outline-hidden ltr:ml-10 rtl:mr-10">
42+
<div class="flex h-9 grow cursor-pointer items-center justify-start rounded-sm">
43+
<a
44+
class="text-muted-foreground group-hover:text-primary truncate text-xs font-semibold tracking-wide focus:outline-hidden">
4345
{{ item.label }}
4446
</a>
4547
</div>
@@ -48,9 +50,13 @@
4850
<!-- Arrow Icon -->
4951
<button
5052
*ngIf="item.children"
51-
[ngClass]="{ hidden: !menuService.showSideBar, 'rotate-90': item.expanded }"
52-
class="text-muted-foreground/50 pointer-events-none absolute top-1 flex items-center p-1 transition-all duration-500 ltr:right-0 rtl:left-0">
53-
<svg-icon src="assets/icons/heroicons/solid/chevron-right.svg" [svgClass]="'h-5 w-5'"> </svg-icon>
53+
[ngClass]="{ hidden: !menuService.showSideBar }"
54+
class="text-foreground/50 flex cursor-pointer items-center justify-end p-0 transition-all duration-500 ltr:right-0 rtl:left-0">
55+
@if(!item.expanded){
56+
<svg-icon src="assets/icons/heroicons/outline/plus.svg" svgClass="h-4 w-4"> </svg-icon>
57+
}@else {
58+
<svg-icon src="assets/icons/heroicons/outline/minus.svg" svgClass="h-4 w-4"> </svg-icon>
59+
}
5460
</button>
5561
</div>
5662

Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div
2-
class="max-h-0 overflow-hidden pt-1 transition-all duration-500 ltr:pl-4 rtl:pr-4"
2+
class="max-h-0 overflow-hidden pt-1 transition-all duration-500 ltr:pl-2.5 rtl:pr-2.5"
33
[ngClass]="{ 'max-h-screen': submenu.expanded }">
44
<ul
55
class="border-border text-muted-foreground flex flex-col border-dashed ltr:border-l ltr:pl-2 rtl:border-r rtl:pr-2">
66
<li *ngFor="let sub of submenu.children">
7-
<div class="hover:bg-card hover:text-foreground flex rounded-sm" (click)="toggleMenu(sub)">
7+
<div class="text-muted-foreground hover:text-primary relative flex rounded-sm" (click)="toggleMenu(sub)">
88
<!-- Condition -->
99
<ng-container
1010
[ngTemplateOutlet]="sub.children ? childMenu : parentMenu"
@@ -18,25 +18,34 @@
1818
[routerLink]="sub.route"
1919
routerLinkActive="text-primary"
2020
[routerLinkActiveOptions]="{ exact: true }"
21-
class="inline-block w-full px-4 py-2 text-xs font-semibold">
21+
class="hover:bg-card inline-block w-full px-4 py-2 text-xs">
2222
{{ sub.label }}
2323
</a>
24+
@if(menuService.isActive(sub.route)){
25+
<span
26+
class="size-1.5 bg-primary absolute flex translate-y-3.5 items-center rounded-full ltr:-translate-x-[11.5px] rtl:translate-x-[11.5px]">
27+
</span>
28+
}
2429
</ng-template>
2530

2631
<!-- Child Menu -->
2732
<ng-template #childMenu let-sub="sub">
28-
<a class="inline-block w-full cursor-pointer px-4 py-2 text-xs font-semibold">
33+
<a class="inline-block w-full cursor-pointer px-4 py-2 text-xs">
2934
{{ sub.label }}
3035
</a>
31-
<button
32-
[ngClass]="{ 'rotate-90': sub.expanded }"
33-
class="text-muted-foreground flex items-center p-1 transition-all duration-500">
34-
<svg-icon src="assets/icons/heroicons/solid/chevron-right.svg" [svgClass]="'h-5 w-5'"> </svg-icon>
36+
<button class="text-foreground/50 flex cursor-pointer items-center justify-end transition-all duration-500">
37+
@if(!sub.expanded){
38+
<svg-icon src="assets/icons/heroicons/outline/plus.svg" svgClass="h-4 w-4"> </svg-icon>
39+
}@else {
40+
<svg-icon src="assets/icons/heroicons/outline/minus.svg" svgClass="h-4 w-4"> </svg-icon>
41+
}
3542
</button>
3643
</ng-template>
3744
</div>
3845
<!-- Submenu items -->
46+
@if(sub.children?.length){
3947
<app-navbar-mobile-submenu [submenu]="sub"></app-navbar-mobile-submenu>
48+
}
4049
</li>
4150
</ul>
4251
</div>

src/app/modules/layout/components/navbar/navbar-mobile/navbar-mobile-submenu/navbar-mobile-submenu.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { MenuService } from 'src/app/modules/layout/services/menu.service';
1414
export class NavbarMobileSubmenuComponent implements OnInit {
1515
@Input() public submenu = <SubMenuItem>{};
1616

17-
constructor(private menuService: MenuService) {}
17+
constructor(public menuService: MenuService) {}
1818

1919
ngOnInit(): void {}
2020

src/app/modules/layout/components/navbar/navbar-mobile/navbar-mobile.component.html

-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
<!--
2-
Mobile menu, show/hide based on mobile menu state.
3-
Entering: "duration-200 ease-out"
4-
From: "opacity-0 scale-95"
5-
To: "opacity-100 scale-100"
6-
Leaving: "duration-100 ease-in"
7-
From: "opacity-100 scale-100"
8-
To: "opacity-0 scale-95"
9-
-->
101
<div
112
[ngClass]="
123
menuService.showMobileMenu
@@ -32,7 +23,6 @@
3223
type="button"
3324
class="text-muted-foreground focus:ring-primary hover:bg-card hover:text-foreground inline-flex items-center justify-center rounded-md p-2 transition-transform hover:rotate-90 focus:outline-hidden focus:ring-2 focus:ring-inset">
3425
<span class="sr-only">Close menu</span>
35-
<!-- Heroicon name: outline/x -->
3626
<svg-icon src="assets/icons/heroicons/outline/x.svg"> </svg-icon>
3727
</button>
3828
</div>

src/app/modules/layout/components/sidebar/sidebar-submenu/sidebar-submenu.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</a>
3838
<button
3939
[ngClass]="{ hidden: !menuService.showSideBar }"
40-
class="text-foreground/50 mx- mx-1 flex cursor-pointer items-center p-1 transition-all duration-500">
40+
class="text-foreground/50 flex cursor-pointer items-center p-1 transition-all duration-500">
4141
@if(!sub.expanded){
4242
<svg-icon src="assets/icons/heroicons/outline/plus.svg" svgClass="h-4 w-4"> </svg-icon>
4343
}@else {

0 commit comments

Comments
 (0)