mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-22 18:30:09 +00:00
feat(mobile-bottom-nav): add active route styling for Today and Planner buttons
- Add active state CSS reusing magic side nav theme variables - Switch to routerLinkActive directive for declarative route matching - Remove manual currentRoute signal tracking
This commit is contained in:
parent
631659de2e
commit
13d3f5e96b
3 changed files with 21 additions and 12 deletions
|
|
@ -2,8 +2,9 @@
|
|||
<button
|
||||
mat-button
|
||||
class="nav-button"
|
||||
[class.active]="currentRoute().includes('/tag/' + todayTagId + '/tasks')"
|
||||
[routerLink]="todayRoute"
|
||||
routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="{ exact: false }"
|
||||
>
|
||||
<mat-icon>wb_sunny</mat-icon>
|
||||
</button>
|
||||
|
|
@ -11,8 +12,8 @@
|
|||
<button
|
||||
mat-button
|
||||
class="nav-button"
|
||||
[class.active]="currentRoute() === '/planner'"
|
||||
routerLink="/planner"
|
||||
routerLinkActive="active"
|
||||
>
|
||||
<mat-icon>edit_calendar</mat-icon>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -49,6 +49,24 @@
|
|||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
// Active state styling - reuse magic side nav theme variables
|
||||
&.active {
|
||||
background: var(--sidenav-item-active-bg);
|
||||
color: var(--sidenav-active-text);
|
||||
box-shadow: var(--whiteframe-shadow-1dp);
|
||||
|
||||
mat-icon {
|
||||
color: var(--sidenav-active-text);
|
||||
}
|
||||
|
||||
// Maintain active state on hover/focus
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: var(--sidenav-item-active-bg);
|
||||
color: var(--sidenav-active-text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.add-task-button {
|
||||
|
|
|
|||
|
|
@ -55,16 +55,6 @@ export class MobileBottomNavComponent {
|
|||
// Output events
|
||||
toggleMobileNavEvent = output<void>();
|
||||
|
||||
// Current route tracking
|
||||
readonly currentRoute = toSignal(
|
||||
this._router.events.pipe(
|
||||
filter((event): event is NavigationEnd => event instanceof NavigationEnd),
|
||||
map((event) => event.urlAfterRedirects),
|
||||
startWith(this._router.url),
|
||||
),
|
||||
{ initialValue: this._router.url },
|
||||
);
|
||||
|
||||
// Plugin-related signals
|
||||
readonly sidePanelButtons = this._pluginBridge.sidePanelButtons;
|
||||
readonly activePluginId = toSignal(this._store.select(selectActivePluginId));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue