Skip to content

Commit f11fc07

Browse files
authored
Merge pull request #4110 from RedisInsight/fe/feature/RI-6287
#RI-6287 - update notification icon
2 parents e17f3e9 + 77295ba commit f11fc07

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

redisinsight/ui/src/components/navigation-menu/components/notifications-center/NotificationMenu.spec.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { fireEvent } from '@testing-library/react'
22
import { cloneDeep } from 'lodash'
33
import React from 'react'
4-
import { setIsCenterOpen } from 'uiSrc/slices/app/notifications'
4+
import { notificationCenterSelector, setIsCenterOpen } from 'uiSrc/slices/app/notifications'
55
import { cleanup, mockedStore, render, screen } from 'uiSrc/utils/test-utils'
66
import NotificationMenu from './NotificationMenu'
77

@@ -41,4 +41,15 @@ describe('NotificationMenu', () => {
4141
expect(screen.getByTestId('total-unread-badge')).toBeInTheDocument()
4242
expect(screen.getByTestId('total-unread-badge')).toHaveTextContent('1')
4343
})
44+
45+
it('should show badge with count 9+ of unread messages', async () => {
46+
(notificationCenterSelector as jest.Mock).mockReturnValueOnce({
47+
notifications: [],
48+
totalUnread: 13,
49+
isCenterOpen: false,
50+
})
51+
render(<NotificationMenu />)
52+
53+
expect(screen.getByTestId('total-unread-badge')).toHaveTextContent('9+')
54+
})
4455
})

redisinsight/ui/src/components/navigation-menu/components/notifications-center/NotificationMenu.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ const NavButton = () => {
3333
return (
3434
<div className={styles.navBtnWrapper}>
3535
{!isCenterOpen && !isNotificationOpen ? (<EuiToolTip content="Notification Center" position="right">{Btn}</EuiToolTip>) : Btn}
36-
{(totalUnread > 0 && !isCenterOpen) && (<div className={styles.badgeUnreadCount} data-testid="total-unread-badge">{totalUnread}</div>)}
36+
{(totalUnread > 0 && !isCenterOpen) && (
37+
<div className={styles.badgeUnreadCount} data-testid="total-unread-badge">
38+
{totalUnread > 9 ? '9+' : totalUnread}
39+
</div>
40+
)}
3741
</div>
3842
)
3943
}

redisinsight/ui/src/components/navigation-menu/components/notifications-center/styles.module.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
.badgeUnreadCount {
1313
position: absolute;
1414

15-
top: 8px;
16-
right: 8px;
17-
width: 24px;
15+
top: 12px;
16+
right: 12px;
17+
width: 16px;
1818
height: 16px;
1919
border-radius: 22px;
2020

21-
background: #9E2A28;
21+
background: #8BA2FF;
2222

2323
text-align: center;
24-
line-height: 14px;
25-
font-size: 12px;
26-
color: #fff;
24+
line-height: 15px;
25+
font-size: 10px;
26+
color: #000;
2727
}
2828
}
2929

0 commit comments

Comments
 (0)