-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from andela/ft-view-notification-166816074
#166816074 user notification view
- Loading branch information
Showing
15 changed files
with
386 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
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
3 changes: 3 additions & 0 deletions
3
src/components/Notifications/__snapshots__/index.spec.js.snap
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,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders the Notificationcomponent correctly 1`] = `ShallowWrapper {}`; |
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,40 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import moment from 'moment'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export const Notification = props => { | ||
const { notification, handleIsread } = props; | ||
return ( | ||
<div className="tray-details"> | ||
<p className="text-center font-weight-bolder text-dark pt-2 pb-2 mb-0 notify-title"> | ||
{' '} | ||
Notifications{' '} | ||
</p> | ||
{notification | ||
? notification.map((item, i) => { | ||
return ( | ||
<Link | ||
to={item.link} | ||
onClick={e => handleIsread(e, item.id)} | ||
key={i} | ||
className={`notification-tray-item ${ | ||
item.isRead ? '' : 'unread' | ||
}`} | ||
> | ||
<p>{item.notificationMessage}</p> | ||
<span>{moment(item.createdAt).fromNow()}</span> | ||
</Link> | ||
); | ||
}) | ||
: ''} | ||
</div> | ||
); | ||
}; | ||
|
||
Notification.propTypes = { | ||
notification: PropTypes.array, | ||
handleIsread: PropTypes.func | ||
}; | ||
|
||
export default Notification; |
Oops, something went wrong.