-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added no notifition yet message bar (#493)
* feat: added no notifition yet message bar * refactor: fixed reviewed issues * refactor: fixed review issues * refactor: refactor code for ref * test: added test cases for no notification section * refactor: remove style and added classes * refactor: added useContext instead of props drilling * refactor: memoize notification refs --------- Co-authored-by: SundasNoreen <sundas.noreen@arbisoft.com>
- Loading branch information
1 parent
3621628
commit 326c522
Showing
8 changed files
with
177 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React, { useContext } from 'react'; | ||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
import { Icon, IconButton } from '@edx/paragon'; | ||
import { NotificationsNone } from '@edx/paragon/icons'; | ||
import NotificationContext from './context'; | ||
import messages from './messages'; | ||
|
||
const EmptyNotifications = () => { | ||
const intl = useIntl(); | ||
const { popoverHeaderRef, notificationRef } = useContext(NotificationContext); | ||
|
||
return ( | ||
<div | ||
className="d-flex flex-column justify-content-center align-items-center" | ||
data-testid="notifications-list-complete" | ||
style={{ height: `${notificationRef.current.clientHeight - popoverHeaderRef.current.clientHeight}px` }} | ||
> | ||
<IconButton | ||
isActive | ||
alt={intl.formatMessage(messages.notificationBellIconAltMessage)} | ||
src={NotificationsNone} | ||
iconAs={Icon} | ||
variant="light" | ||
id="bell-icon" | ||
iconClassNames="text-primary-500" | ||
className="ml-4 mr-1 notification-button notification-lg-bell-icon" | ||
data-testid="notification-bell-icon" | ||
/> | ||
<div className="mx-auto mt-3.5 mb-3 font-size-22 notification-end-title line-height-24"> | ||
{intl.formatMessage(messages.noNotificationsYetMessage)} | ||
</div> | ||
<div className="d-flex flex-row mx-auto text-gray-500"> | ||
<span className="font-size-14 line-height-normal"> | ||
{intl.formatMessage(messages.noNotificationHelpMessage)} | ||
</span> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default React.memo(EmptyNotifications); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react'; | ||
|
||
const NotificationContext = React.createContext({ popoverHeaderRef: null, notificationRef: null }); | ||
|
||
export default NotificationContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters