Skip to content

Commit 990d989

Browse files
committed
fix: show notification dot in collapsed menu
Render a plain red dot instead of the unread count in the collapsed sidebar so it no longer overlaps the bell icon. Signed-off-by: Alex Piatakov <alex.piatakov@swirldslabs.com>
1 parent 2e254c0 commit 990d989

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

frontend/src/app/components/notification/notification.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
<div
33
*ngIf="unreadNotifications > 0"
44
(click)="onMenuOpened($event, notificationMenu)"
5-
class="badge"
5+
[class.badge]="!compact"
6+
[class.badge-dot]="compact"
67
>
7-
<span class="notification-counter">
8+
<span *ngIf="!compact" class="notification-counter">
89
{{ unreadNotifications }}
910
</span>
1011
</div>

frontend/src/app/components/notification/notification.component.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@
5757
}
5858
}
5959

60+
.badge-dot {
61+
width: 8px;
62+
height: 8px;
63+
border-radius: 50%;
64+
background-color: #ff432a;
65+
cursor: pointer;
66+
67+
&:hover {
68+
filter: brightness(1.2);
69+
}
70+
}
71+
6072
.notification-position {
6173
pointer-events: none;
6274
position: fixed;

frontend/src/app/components/notification/notification.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core';
1+
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
22
import { Router } from '@angular/router';
33
import { NotificationType, NotifyAPI, } from '@guardian/interfaces';
44
import { ToastrService } from 'ngx-toastr';
@@ -19,6 +19,9 @@ export class NotificationComponent implements OnInit {
1919
menuOpened: boolean = false;
2020
subscription = new Subscription();
2121

22+
/** Show a plain red dot instead of the unread count (used in the collapsed menu). */
23+
@Input() compact: boolean = false;
24+
2225
@Output() menuOpenedChange = new EventEmitter<boolean>();
2326

2427
viewDetails($event: MouseEvent, notification: any) {

frontend/src/app/views/new-header/new-header.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
<i class="pi pi-bell item-icon"></i>
111111
@if (menuCollapsed && layout === 'vertical') {
112112
<div class="collapsed-notify-counter">
113-
<app-notification></app-notification>
113+
<app-notification [compact]="true"></app-notification>
114114
</div>
115115
}
116116
<div [class.hidden-logotype]="menuCollapsed && layout === 'vertical'" class="span-icon">

0 commit comments

Comments
 (0)